You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by "Trenton D. Adams" <tr...@trentonadams.ca> on 2014/12/17 01:21:22 UTC

ClassCastException on maven enhancing

Good day,

I have a maven build.  When I run "mvn install" my unit tests run just 
fine, as does the enhancer...
[INFO] --- openjpa-maven-plugin:1.1:enhance (enhancer) @ webdirectory ---
66  athome  INFO   [main] openjpa.Tool - Enhancer running on type 
"ca.tnt.athome.Town".
190  athome  INFO   [main] openjpa.Tool - Enhancer running on type 
"ca.tnt.athome.HouseListing".

But, when I run "mvn install tomcat:deploy", the enhancer plugin tries 
to run again, and this...

[INFO] --- openjpa-maven-plugin:1.1:enhance (enhancer) @ webdirectory ---
An error occurred while attempting to determine the version of 
"file:/home/trenta/LocalDocuments/development/java/athome/web-directory/target/classes/META-INF/persistence.xml".
[INFO] 
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] 
------------------------------------------------------------------------
[INFO] Total time: 9.535 s
[INFO] Finished at: 2014-12-16T17:18:11-07:00
[INFO] Final Memory: 13M/218M
[INFO] 
------------------------------------------------------------------------
[ERROR] Failed to execute goal 
org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance (enhancer) on project 
webdirectory: Execution enhancer of goal 
org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance failed: 
org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.ClassCastException: 
org.apache.xerces.parsers.XML11Configuration cannot be cast to 
org.apache.xerces.xni.parser.XMLParserConfiguration -> [Help 1]

I've been googling, and trying to debug this for awhile, and just don't 
know what it is.  Any ideas?

Maven plugin configuration below.

       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>openjpa-maven-plugin</artifactId>
         <version>1.1</version>
         <configuration>
           <includes>**/entities/*.class</includes>
           <excludes>**/entities/XML*.class</excludes>
<addDefaultConstructor>true</addDefaultConstructor>
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
         </configuration>
         <executions>
           <execution>
             <id>enhancer</id>
             <phase>process-classes</phase>
             <goals>
               <goal>enhance</goal>
             </goals>
           </execution>
         </executions>
         <dependencies>
           <dependency>
             <groupId>org.apache.openjpa</groupId>
             <artifactId>openjpa-all</artifactId>
             <version>2.3.0</version>
           </dependency>
         </dependencies>
       </plugin>

Re: ClassCastException on maven enhancing

Posted by "Trenton D. Adams" <tr...@trentonadams.ca>.
On 2014-12-23 7:23 AM, Trenton D. Adams wrote:
> On 2014-12-21 10:19 AM, Rick Curtis wrote:
>>> Seems like maybe an openjpa maven plugin bug?
>> I would guess that the openjpa maven plugin class dependencies are
>> conflicting with the tomcat6 dependencies. Can you run mvn install 
>> followed
>> by mvn tomcat6:deploy?
>
> Yes, that works, but I'm not sure I understand why it would.  The 
> enhancer is ran both times.
>
> The following reveals it's ran both times, so why would the one with 
> *install* make it have a dependency conflict?

Yeah, "install" does not run automatically when running the tomcat 
plugin.  I found that out when I updated a class, and it wouldn't 
update.  So the install is required.

Anyhow, in a maven rmi plugin I wrote, I got around dependency problems 
by writing my own class loading stuff for maven.  That's probably what 
needs to occur here too.  Unfortunately, I don't have the time to look 
at the openjpa plugin at the moment. :(


Re: ClassCastException on maven enhancing

Posted by "Trenton D. Adams" <tr...@trentonadams.ca>.
On 2014-12-21 10:19 AM, Rick Curtis wrote:
>> Seems like maybe an openjpa maven plugin bug?
> I would guess that the openjpa maven plugin class dependencies are
> conflicting with the tomcat6 dependencies. Can you run mvn install followed
> by mvn tomcat6:deploy?

Yes, that works, but I'm not sure I understand why it would.  The 
enhancer is ran both times.

The following reveals it's ran both times, so why would the one with 
*install* make it have a dependency conflict?

>
> On Sun, Dec 21, 2014 at 12:55 AM, Trenton D. Adams <tr...@trentonadams.ca>
> wrote:
>> On 2014-12-16 8:34 PM, Trenton D. Adams wrote:
>>
>>> The following now works.
>>> mvn install tomcat6:deploy
>>>
>> Correction, this works...
>> mvn tomcat6:deploy
>>
>> As does...
>> mvn tomcat6:undeploy tomcat6:deploy
>>
>> But this does not...
>> mvn install tomcat6:deploy
>>
>> Which fails with the previously mentioned error of...
>> [ERROR] Failed to execute goal org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance
>> (enhancer) on project webdirectory: Execution enhancer of goal
>> org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance failed:
>> org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.ClassCastException:
>> org.apache.xerces.parsers.XML11Configuration cannot be cast to
>> org.apache.xerces.xni.parser.XMLParserConfiguration -> [Help 1]
>>
>> Any ideas on why an "install" would make it fail, even though install is
>> presumably a requirement of tomcat6:deploy anyhow?
>>
>> Seems like maybe an openjpa maven plugin bug?
>>
>


Re: ClassCastException on maven enhancing

Posted by Rick Curtis <cu...@gmail.com>.
> Seems like maybe an openjpa maven plugin bug?

I would guess that the openjpa maven plugin class dependencies are
conflicting with the tomcat6 dependencies. Can you run mvn install followed
by mvn tomcat6:deploy?

On Sun, Dec 21, 2014 at 12:55 AM, Trenton D. Adams <tr...@trentonadams.ca>
wrote:
>
> On 2014-12-16 8:34 PM, Trenton D. Adams wrote:
>
>> The following now works.
>> mvn install tomcat6:deploy
>>
>
> Correction, this works...
> mvn tomcat6:deploy
>
> As does...
> mvn tomcat6:undeploy tomcat6:deploy
>
> But this does not...
> mvn install tomcat6:deploy
>
> Which fails with the previously mentioned error of...
> [ERROR] Failed to execute goal org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance
> (enhancer) on project webdirectory: Execution enhancer of goal
> org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance failed:
> org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.ClassCastException:
> org.apache.xerces.parsers.XML11Configuration cannot be cast to
> org.apache.xerces.xni.parser.XMLParserConfiguration -> [Help 1]
>
> Any ideas on why an "install" would make it fail, even though install is
> presumably a requirement of tomcat6:deploy anyhow?
>
> Seems like maybe an openjpa maven plugin bug?
>


-- 
*Rick Curtis*

Re: ClassCastException on maven enhancing

Posted by "Trenton D. Adams" <tr...@trentonadams.ca>.
On 2014-12-16 8:34 PM, Trenton D. Adams wrote:
> The following now works.
> mvn install tomcat6:deploy

Correction, this works...
mvn tomcat6:deploy

As does...
mvn tomcat6:undeploy tomcat6:deploy

But this does not...
mvn install tomcat6:deploy

Which fails with the previously mentioned error of...
[ERROR] Failed to execute goal 
org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance (enhancer) on project 
webdirectory: Execution enhancer of goal 
org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance failed: 
org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.ClassCastException: 
org.apache.xerces.parsers.XML11Configuration cannot be cast to 
org.apache.xerces.xni.parser.XMLParserConfiguration -> [Help 1]

Any ideas on why an "install" would make it fail, even though install is 
presumably a requirement of tomcat6:deploy anyhow?

Seems like maybe an openjpa maven plugin bug?

Re: ClassCastException on maven enhancing

Posted by "Trenton D. Adams" <tr...@trentonadams.ca>.
No clue what's wrong, and I couldn't figure it out.

I decided to deploy the WAR manually, using the manager, and pointing it 
to the WAR file.  That worked fine, which lead me to another solution.

Since I'm using tomcat6, I switched to the tomcat6 plugin, and that 
works.  I just don't get it.  I'm fairly certain I did not change my 
environment at all, as it's been working for 2-3 weeks. The maven plugin 
wasn't updated since 2013.

The following now works.
mvn install tomcat6:deploy

As does...
# the old plugin, which consequently runs tomcat 6 as well.
mvn tomcat:run

But, as to why it suddenly stopped working on me, causing me hours of 
frustration, I'm at a loss.  I was deploying yesterday, and it just 
suddenly wouldn't work anymore.  Reverting back many git revisions, even 
to where I first started using openjpa, and it still doesn't work.  I 
was going to use "git bisect", but I couldn't find a good revision to 
work with. :(

I don't normally give up, but I'm giving up, cause I have a solution, 
it's just not the ideal solution because I wanted to know what was 
wrong; especially since this happened so suddenly.

On 2014-12-16 7:22 PM, Rick Curtis wrote:
> Trenton -
>
> Sorry I'm not much help, but I have no idea what's going on. Please let us
> know if/when you figure out what is causing this problem.
>
> Thanks,
> Rick
>
> On Tue, Dec 16, 2014 at 8:07 PM, Trenton D. Adams <tr...@trentonadams.ca>
> wrote:
>> Hi Rick,
>>
>> I'm using Java 1.7 and tomcat 6.
>>
>> I'm really not sure what is wrong.  I checked out old revisions, which I
>> know could at least deploy to tomcat, and they do not work either now.
>> That makes me wonder about my environment, but I don't know what it could
>> be.  I did review the xerces libraries coming in using the maven -X
>> parameter, and they are all 2.4.0.
>>
>> It's just all very strange.  I did, unfortunately, have open ended
>> versions on some of my plugins in my poms, which I fixed yesterday, but I'm
>> wondering if it's possible that something was released, which messed it up
>> on me.  I'm going to go find out which plugins those were, and see if I can
>> push back the versions used and see what happens.
>>
>> The full stack trace is below...
>> [ERROR] Failed to execute goal org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance
>> (enhancer) on project webdirectory: Execution enhancer of goal
>> org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance failed:
>> org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.ClassCastException:
>> org.apache.xerces.parsers.XML11Configuration cannot be cast to
>> org.apache.xerces.xni.parser.XMLParserConfiguration -> [Help 1]
>> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
>> goal org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance (enhancer) on
>> project webdirectory: Execution enhancer of goal org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance
>> failed: org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.ClassCastException:
>> org.apache.xerces.parsers.XML11Configuration cannot be cast to
>> org.apache.xerces.xni.parser.XMLParserConfiguration
>>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
>> MojoExecutor.java:224)
>>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
>> MojoExecutor.java:153)
>>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
>> MojoExecutor.java:145)
>>      at org.apache.maven.lifecycle.internal.MojoExecutor.
>> executeForkedExecutions(MojoExecutor.java:364)
>>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
>> MojoExecutor.java:198)
>>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
>> MojoExecutor.java:153)
>>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
>> MojoExecutor.java:145)
>>      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.
>> buildProject(LifecycleModuleBuilder.java:116)
>>      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.
>> buildProject(LifecycleModuleBuilder.java:80)
>>      at org.apache.maven.lifecycle.internal.builder.singlethreaded.
>> SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
>>      at org.apache.maven.lifecycle.internal.LifecycleStarter.
>> execute(LifecycleStarter.java:120)
>>      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
>>      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
>>      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
>>      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
>>      at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
>>      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>      at sun.reflect.NativeMethodAccessorImpl.invoke(
>> NativeMethodAccessorImpl.java:57)
>>      at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:43)
>>      at java.lang.reflect.Method.invoke(Method.java:606)
>>      at org.codehaus.plexus.classworlds.launcher.Launcher.
>> launchEnhanced(Launcher.java:289)
>>      at org.codehaus.plexus.classworlds.launcher.Launcher.
>> launch(Launcher.java:229)
>>      at org.codehaus.plexus.classworlds.launcher.Launcher.
>> mainWithExitCode(Launcher.java:415)
>>      at org.codehaus.plexus.classworlds.launcher.Launcher.
>> main(Launcher.java:356)
>> Caused by: org.apache.maven.plugin.PluginExecutionException: Execution
>> enhancer of goal org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance
>> failed: org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.ClassCastException:
>> org.apache.xerces.parsers.XML11Configuration cannot be cast to
>> org.apache.xerces.xni.parser.XMLParserConfiguration
>>      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(
>> DefaultBuildPluginManager.java:143)
>>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
>> MojoExecutor.java:208)
>>      ... 23 more
>> Caused by: java.util.MissingResourceException: org.apache.openjpa.
>> persistence.PersistenceProductDerivation:java.lang.ClassCastException:
>> org.apache.xerces.parsers.XML11Configuration cannot be cast to
>> org.apache.xerces.xni.parser.XMLParserConfiguration
>>      at org.apache.openjpa.lib.conf.ProductDerivations.reportErrors(
>> ProductDerivations.java:381)
>>      at org.apache.openjpa.lib.conf.ProductDerivations.
>> getFullyQualifiedAnchorsInPropertiesLocation(ProductDerivations.java:434)
>>      at org.apache.openjpa.lib.conf.Configurations.
>> getFullyQualifiedAnchorsInPropertiesLocation(Configurations.java:326)
>>      at org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(
>> Configurations.java:738)
>>      at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4795)
>>      at org.codehaus.mojo.openjpa.AbstractOpenJpaEnhancerMojo.enhance(
>> AbstractOpenJpaEnhancerMojo.java:136)
>>      at org.codehaus.mojo.openjpa.AbstractOpenJpaEnhancerMojo.execute(
>> AbstractOpenJpaEnhancerMojo.java:95)
>>      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(
>> DefaultBuildPluginManager.java:132)
>>      ... 24 more
>> Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration
>> cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
>>      at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
>>      at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
>>      at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
>>      at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown
>> Source)
>>      at org.apache.openjpa.lib.xml.XMLFactory.getSAXParser(
>> XMLFactory.java:81)
>>      at org.apache.openjpa.lib.meta.XMLMetaDataParser.parseNewResource(
>> XMLMetaDataParser.java:400)
>>      at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(
>> XMLMetaDataParser.java:347)
>>      at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(
>> XMLMetaDataParser.java:324)
>>      at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(
>> XMLMetaDataParser.java:297)
>>      at org.apache.openjpa.persistence.PersistenceProductDerivation$
>> ConfigurationParser.parse(PersistenceProductDerivation.java:811)
>>      at org.apache.openjpa.persistence.PersistenceProductDerivation.
>> getAnchorsInResource(PersistenceProductDerivation.java:423)
>>      at org.apache.openjpa.lib.conf.ProductDerivations.
>> getFullyQualifiedAnchorsInPropertiesLocation(ProductDerivations.java:405)
>>      ... 30 more
>>
>>
>> On 2014-12-16 6:46 PM, Rick Curtis wrote:
>>
>>> What jvm/version are you using? Have you tried to debug to see where the
>>> multiple versions of Xerces are coming from?
>>>
>>> On Tue, Dec 16, 2014 at 6:21 PM, Trenton D. Adams <tr...@trentonadams.ca>
>>> wrote:
>>>
>>>> Good day,
>>>>
>>>> I have a maven build.  When I run "mvn install" my unit tests run just
>>>> fine, as does the enhancer...
>>>> [INFO] --- openjpa-maven-plugin:1.1:enhance (enhancer) @ webdirectory
>>>> ---
>>>> 66  athome  INFO   [main] openjpa.Tool - Enhancer running on type
>>>> "ca.tnt.athome.Town".
>>>> 190  athome  INFO   [main] openjpa.Tool - Enhancer running on type
>>>> "ca.tnt.athome.HouseListing".
>>>>
>>>> But, when I run "mvn install tomcat:deploy", the enhancer plugin tries to
>>>> run again, and this...
>>>>
>>>> [INFO] --- openjpa-maven-plugin:1.1:enhance (enhancer) @ webdirectory
>>>> ---
>>>> An error occurred while attempting to determine the version of
>>>> "file:/home/trenta/LocalDocuments/development/java/athome/web-directory/
>>>> target/classes/META-INF/persistence.xml".
>>>> [INFO] ------------------------------------------------------------
>>>> ------------
>>>> [INFO] BUILD FAILURE
>>>> [INFO] ------------------------------------------------------------
>>>> ------------
>>>> [INFO] Total time: 9.535 s
>>>> [INFO] Finished at: 2014-12-16T17:18:11-07:00
>>>> [INFO] Final Memory: 13M/218M
>>>> [INFO] ------------------------------------------------------------
>>>> ------------
>>>> [ERROR] Failed to execute goal org.codehaus.mojo:openjpa-
>>>> maven-plugin:1.1:enhance
>>>> (enhancer) on project webdirectory: Execution enhancer of goal
>>>> org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance failed:
>>>> org.apache.openjpa.persistence.PersistenceProductDerivation:
>>>> java.lang.ClassCastException:
>>>> org.apache.xerces.parsers.XML11Configuration cannot be cast to
>>>> org.apache.xerces.xni.parser.XMLParserConfiguration -> [Help 1]
>>>>
>>>> I've been googling, and trying to debug this for awhile, and just don't
>>>> know what it is.  Any ideas?
>>>>
>>>> Maven plugin configuration below.
>>>>
>>>>         <plugin>
>>>>           <groupId>org.codehaus.mojo</groupId>
>>>>           <artifactId>openjpa-maven-plugin</artifactId>
>>>>           <version>1.1</version>
>>>>           <configuration>
>>>>             <includes>**/entities/*.class</includes>
>>>>             <excludes>**/entities/XML*.class</excludes>
>>>> <addDefaultConstructor>true</addDefaultConstructor>
>>>> <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
>>>>           </configuration>
>>>>           <executions>
>>>>             <execution>
>>>>               <id>enhancer</id>
>>>>               <phase>process-classes</phase>
>>>>               <goals>
>>>>                 <goal>enhance</goal>
>>>>               </goals>
>>>>             </execution>
>>>>           </executions>
>>>>           <dependencies>
>>>>             <dependency>
>>>>               <groupId>org.apache.openjpa</groupId>
>>>>               <artifactId>openjpa-all</artifactId>
>>>>               <version>2.3.0</version>
>>>>             </dependency>
>>>>           </dependencies>
>>>>         </plugin>
>>>>
>>>>


Re: ClassCastException on maven enhancing

Posted by Rick Curtis <cu...@gmail.com>.
Trenton -

Sorry I'm not much help, but I have no idea what's going on. Please let us
know if/when you figure out what is causing this problem.

Thanks,
Rick

On Tue, Dec 16, 2014 at 8:07 PM, Trenton D. Adams <tr...@trentonadams.ca>
wrote:
>
> Hi Rick,
>
> I'm using Java 1.7 and tomcat 6.
>
> I'm really not sure what is wrong.  I checked out old revisions, which I
> know could at least deploy to tomcat, and they do not work either now.
> That makes me wonder about my environment, but I don't know what it could
> be.  I did review the xerces libraries coming in using the maven -X
> parameter, and they are all 2.4.0.
>
> It's just all very strange.  I did, unfortunately, have open ended
> versions on some of my plugins in my poms, which I fixed yesterday, but I'm
> wondering if it's possible that something was released, which messed it up
> on me.  I'm going to go find out which plugins those were, and see if I can
> push back the versions used and see what happens.
>
> The full stack trace is below...
> [ERROR] Failed to execute goal org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance
> (enhancer) on project webdirectory: Execution enhancer of goal
> org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance failed:
> org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.ClassCastException:
> org.apache.xerces.parsers.XML11Configuration cannot be cast to
> org.apache.xerces.xni.parser.XMLParserConfiguration -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
> goal org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance (enhancer) on
> project webdirectory: Execution enhancer of goal org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance
> failed: org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.ClassCastException:
> org.apache.xerces.parsers.XML11Configuration cannot be cast to
> org.apache.xerces.xni.parser.XMLParserConfiguration
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
> MojoExecutor.java:224)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
> MojoExecutor.java:153)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
> MojoExecutor.java:145)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.
> executeForkedExecutions(MojoExecutor.java:364)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
> MojoExecutor.java:198)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
> MojoExecutor.java:153)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
> MojoExecutor.java:145)
>     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.
> buildProject(LifecycleModuleBuilder.java:116)
>     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.
> buildProject(LifecycleModuleBuilder.java:80)
>     at org.apache.maven.lifecycle.internal.builder.singlethreaded.
> SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
>     at org.apache.maven.lifecycle.internal.LifecycleStarter.
> execute(LifecycleStarter.java:120)
>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
>     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
>     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
>     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
>     at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:57)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:606)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.
> launchEnhanced(Launcher.java:289)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.
> launch(Launcher.java:229)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.
> mainWithExitCode(Launcher.java:415)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.
> main(Launcher.java:356)
> Caused by: org.apache.maven.plugin.PluginExecutionException: Execution
> enhancer of goal org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance
> failed: org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.ClassCastException:
> org.apache.xerces.parsers.XML11Configuration cannot be cast to
> org.apache.xerces.xni.parser.XMLParserConfiguration
>     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(
> DefaultBuildPluginManager.java:143)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
> MojoExecutor.java:208)
>     ... 23 more
> Caused by: java.util.MissingResourceException: org.apache.openjpa.
> persistence.PersistenceProductDerivation:java.lang.ClassCastException:
> org.apache.xerces.parsers.XML11Configuration cannot be cast to
> org.apache.xerces.xni.parser.XMLParserConfiguration
>     at org.apache.openjpa.lib.conf.ProductDerivations.reportErrors(
> ProductDerivations.java:381)
>     at org.apache.openjpa.lib.conf.ProductDerivations.
> getFullyQualifiedAnchorsInPropertiesLocation(ProductDerivations.java:434)
>     at org.apache.openjpa.lib.conf.Configurations.
> getFullyQualifiedAnchorsInPropertiesLocation(Configurations.java:326)
>     at org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(
> Configurations.java:738)
>     at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4795)
>     at org.codehaus.mojo.openjpa.AbstractOpenJpaEnhancerMojo.enhance(
> AbstractOpenJpaEnhancerMojo.java:136)
>     at org.codehaus.mojo.openjpa.AbstractOpenJpaEnhancerMojo.execute(
> AbstractOpenJpaEnhancerMojo.java:95)
>     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(
> DefaultBuildPluginManager.java:132)
>     ... 24 more
> Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration
> cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
>     at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
>     at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
>     at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
>     at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown
> Source)
>     at org.apache.openjpa.lib.xml.XMLFactory.getSAXParser(
> XMLFactory.java:81)
>     at org.apache.openjpa.lib.meta.XMLMetaDataParser.parseNewResource(
> XMLMetaDataParser.java:400)
>     at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(
> XMLMetaDataParser.java:347)
>     at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(
> XMLMetaDataParser.java:324)
>     at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(
> XMLMetaDataParser.java:297)
>     at org.apache.openjpa.persistence.PersistenceProductDerivation$
> ConfigurationParser.parse(PersistenceProductDerivation.java:811)
>     at org.apache.openjpa.persistence.PersistenceProductDerivation.
> getAnchorsInResource(PersistenceProductDerivation.java:423)
>     at org.apache.openjpa.lib.conf.ProductDerivations.
> getFullyQualifiedAnchorsInPropertiesLocation(ProductDerivations.java:405)
>     ... 30 more
>
>
> On 2014-12-16 6:46 PM, Rick Curtis wrote:
>
>> What jvm/version are you using? Have you tried to debug to see where the
>> multiple versions of Xerces are coming from?
>>
>> On Tue, Dec 16, 2014 at 6:21 PM, Trenton D. Adams <tr...@trentonadams.ca>
>> wrote:
>>
>>> Good day,
>>>
>>> I have a maven build.  When I run "mvn install" my unit tests run just
>>> fine, as does the enhancer...
>>> [INFO] --- openjpa-maven-plugin:1.1:enhance (enhancer) @ webdirectory
>>> ---
>>> 66  athome  INFO   [main] openjpa.Tool - Enhancer running on type
>>> "ca.tnt.athome.Town".
>>> 190  athome  INFO   [main] openjpa.Tool - Enhancer running on type
>>> "ca.tnt.athome.HouseListing".
>>>
>>> But, when I run "mvn install tomcat:deploy", the enhancer plugin tries to
>>> run again, and this...
>>>
>>> [INFO] --- openjpa-maven-plugin:1.1:enhance (enhancer) @ webdirectory
>>> ---
>>> An error occurred while attempting to determine the version of
>>> "file:/home/trenta/LocalDocuments/development/java/athome/web-directory/
>>> target/classes/META-INF/persistence.xml".
>>> [INFO] ------------------------------------------------------------
>>> ------------
>>> [INFO] BUILD FAILURE
>>> [INFO] ------------------------------------------------------------
>>> ------------
>>> [INFO] Total time: 9.535 s
>>> [INFO] Finished at: 2014-12-16T17:18:11-07:00
>>> [INFO] Final Memory: 13M/218M
>>> [INFO] ------------------------------------------------------------
>>> ------------
>>> [ERROR] Failed to execute goal org.codehaus.mojo:openjpa-
>>> maven-plugin:1.1:enhance
>>> (enhancer) on project webdirectory: Execution enhancer of goal
>>> org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance failed:
>>> org.apache.openjpa.persistence.PersistenceProductDerivation:
>>> java.lang.ClassCastException:
>>> org.apache.xerces.parsers.XML11Configuration cannot be cast to
>>> org.apache.xerces.xni.parser.XMLParserConfiguration -> [Help 1]
>>>
>>> I've been googling, and trying to debug this for awhile, and just don't
>>> know what it is.  Any ideas?
>>>
>>> Maven plugin configuration below.
>>>
>>>        <plugin>
>>>          <groupId>org.codehaus.mojo</groupId>
>>>          <artifactId>openjpa-maven-plugin</artifactId>
>>>          <version>1.1</version>
>>>          <configuration>
>>>            <includes>**/entities/*.class</includes>
>>>            <excludes>**/entities/XML*.class</excludes>
>>> <addDefaultConstructor>true</addDefaultConstructor>
>>> <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
>>>          </configuration>
>>>          <executions>
>>>            <execution>
>>>              <id>enhancer</id>
>>>              <phase>process-classes</phase>
>>>              <goals>
>>>                <goal>enhance</goal>
>>>              </goals>
>>>            </execution>
>>>          </executions>
>>>          <dependencies>
>>>            <dependency>
>>>              <groupId>org.apache.openjpa</groupId>
>>>              <artifactId>openjpa-all</artifactId>
>>>              <version>2.3.0</version>
>>>            </dependency>
>>>          </dependencies>
>>>        </plugin>
>>>
>>>
>>
>

-- 
*Rick Curtis*

Re: ClassCastException on maven enhancing

Posted by "Trenton D. Adams" <tr...@trentonadams.ca>.
Hi Rick,

I'm using Java 1.7 and tomcat 6.

I'm really not sure what is wrong.  I checked out old revisions, which I 
know could at least deploy to tomcat, and they do not work either now.  
That makes me wonder about my environment, but I don't know what it 
could be.  I did review the xerces libraries coming in using the maven 
-X parameter, and they are all 2.4.0.

It's just all very strange.  I did, unfortunately, have open ended 
versions on some of my plugins in my poms, which I fixed yesterday, but 
I'm wondering if it's possible that something was released, which messed 
it up on me.  I'm going to go find out which plugins those were, and see 
if I can push back the versions used and see what happens.

The full stack trace is below...
[ERROR] Failed to execute goal 
org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance (enhancer) on project 
webdirectory: Execution enhancer of goal 
org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance failed: 
org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.ClassCastException: 
org.apache.xerces.parsers.XML11Configuration cannot be cast to 
org.apache.xerces.xni.parser.XMLParserConfiguration -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to 
execute goal org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance 
(enhancer) on project webdirectory: Execution enhancer of goal 
org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance failed: 
org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.ClassCastException: 
org.apache.xerces.parsers.XML11Configuration cannot be cast to 
org.apache.xerces.xni.parser.XMLParserConfiguration
     at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
     at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
     at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
     at 
org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:364)
     at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:198)
     at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
     at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
     at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
     at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
     at 
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
     at 
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
     at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:606)
     at 
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
     at 
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
     at 
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
     at 
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution 
enhancer of goal org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance 
failed: 
org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.ClassCastException: 
org.apache.xerces.parsers.XML11Configuration cannot be cast to 
org.apache.xerces.xni.parser.XMLParserConfiguration
     at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:143)
     at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
     ... 23 more
Caused by: java.util.MissingResourceException: 
org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.ClassCastException: 
org.apache.xerces.parsers.XML11Configuration cannot be cast to 
org.apache.xerces.xni.parser.XMLParserConfiguration
     at 
org.apache.openjpa.lib.conf.ProductDerivations.reportErrors(ProductDerivations.java:381)
     at 
org.apache.openjpa.lib.conf.ProductDerivations.getFullyQualifiedAnchorsInPropertiesLocation(ProductDerivations.java:434)
     at 
org.apache.openjpa.lib.conf.Configurations.getFullyQualifiedAnchorsInPropertiesLocation(Configurations.java:326)
     at 
org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:738)
     at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4795)
     at 
org.codehaus.mojo.openjpa.AbstractOpenJpaEnhancerMojo.enhance(AbstractOpenJpaEnhancerMojo.java:136)
     at 
org.codehaus.mojo.openjpa.AbstractOpenJpaEnhancerMojo.execute(AbstractOpenJpaEnhancerMojo.java:95)
     at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
     ... 24 more
Caused by: java.lang.ClassCastException: 
org.apache.xerces.parsers.XML11Configuration cannot be cast to 
org.apache.xerces.xni.parser.XMLParserConfiguration
     at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
     at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
     at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
     at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown 
Source)
     at 
org.apache.openjpa.lib.xml.XMLFactory.getSAXParser(XMLFactory.java:81)
     at 
org.apache.openjpa.lib.meta.XMLMetaDataParser.parseNewResource(XMLMetaDataParser.java:400)
     at 
org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:347)
     at 
org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:324)
     at 
org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:297)
     at 
org.apache.openjpa.persistence.PersistenceProductDerivation$ConfigurationParser.parse(PersistenceProductDerivation.java:811)
     at 
org.apache.openjpa.persistence.PersistenceProductDerivation.getAnchorsInResource(PersistenceProductDerivation.java:423)
     at 
org.apache.openjpa.lib.conf.ProductDerivations.getFullyQualifiedAnchorsInPropertiesLocation(ProductDerivations.java:405)
     ... 30 more

On 2014-12-16 6:46 PM, Rick Curtis wrote:
> What jvm/version are you using? Have you tried to debug to see where the
> multiple versions of Xerces are coming from?
>
> On Tue, Dec 16, 2014 at 6:21 PM, Trenton D. Adams <tr...@trentonadams.ca>
> wrote:
>> Good day,
>>
>> I have a maven build.  When I run "mvn install" my unit tests run just
>> fine, as does the enhancer...
>> [INFO] --- openjpa-maven-plugin:1.1:enhance (enhancer) @ webdirectory ---
>> 66  athome  INFO   [main] openjpa.Tool - Enhancer running on type
>> "ca.tnt.athome.Town".
>> 190  athome  INFO   [main] openjpa.Tool - Enhancer running on type
>> "ca.tnt.athome.HouseListing".
>>
>> But, when I run "mvn install tomcat:deploy", the enhancer plugin tries to
>> run again, and this...
>>
>> [INFO] --- openjpa-maven-plugin:1.1:enhance (enhancer) @ webdirectory ---
>> An error occurred while attempting to determine the version of
>> "file:/home/trenta/LocalDocuments/development/java/athome/web-directory/
>> target/classes/META-INF/persistence.xml".
>> [INFO] ------------------------------------------------------------
>> ------------
>> [INFO] BUILD FAILURE
>> [INFO] ------------------------------------------------------------
>> ------------
>> [INFO] Total time: 9.535 s
>> [INFO] Finished at: 2014-12-16T17:18:11-07:00
>> [INFO] Final Memory: 13M/218M
>> [INFO] ------------------------------------------------------------
>> ------------
>> [ERROR] Failed to execute goal org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance
>> (enhancer) on project webdirectory: Execution enhancer of goal
>> org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance failed:
>> org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.ClassCastException:
>> org.apache.xerces.parsers.XML11Configuration cannot be cast to
>> org.apache.xerces.xni.parser.XMLParserConfiguration -> [Help 1]
>>
>> I've been googling, and trying to debug this for awhile, and just don't
>> know what it is.  Any ideas?
>>
>> Maven plugin configuration below.
>>
>>        <plugin>
>>          <groupId>org.codehaus.mojo</groupId>
>>          <artifactId>openjpa-maven-plugin</artifactId>
>>          <version>1.1</version>
>>          <configuration>
>>            <includes>**/entities/*.class</includes>
>>            <excludes>**/entities/XML*.class</excludes>
>> <addDefaultConstructor>true</addDefaultConstructor>
>> <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
>>          </configuration>
>>          <executions>
>>            <execution>
>>              <id>enhancer</id>
>>              <phase>process-classes</phase>
>>              <goals>
>>                <goal>enhance</goal>
>>              </goals>
>>            </execution>
>>          </executions>
>>          <dependencies>
>>            <dependency>
>>              <groupId>org.apache.openjpa</groupId>
>>              <artifactId>openjpa-all</artifactId>
>>              <version>2.3.0</version>
>>            </dependency>
>>          </dependencies>
>>        </plugin>
>>
>


Re: ClassCastException on maven enhancing

Posted by Rick Curtis <cu...@gmail.com>.
What jvm/version are you using? Have you tried to debug to see where the
multiple versions of Xerces are coming from?

On Tue, Dec 16, 2014 at 6:21 PM, Trenton D. Adams <tr...@trentonadams.ca>
wrote:
>
> Good day,
>
> I have a maven build.  When I run "mvn install" my unit tests run just
> fine, as does the enhancer...
> [INFO] --- openjpa-maven-plugin:1.1:enhance (enhancer) @ webdirectory ---
> 66  athome  INFO   [main] openjpa.Tool - Enhancer running on type
> "ca.tnt.athome.Town".
> 190  athome  INFO   [main] openjpa.Tool - Enhancer running on type
> "ca.tnt.athome.HouseListing".
>
> But, when I run "mvn install tomcat:deploy", the enhancer plugin tries to
> run again, and this...
>
> [INFO] --- openjpa-maven-plugin:1.1:enhance (enhancer) @ webdirectory ---
> An error occurred while attempting to determine the version of
> "file:/home/trenta/LocalDocuments/development/java/athome/web-directory/
> target/classes/META-INF/persistence.xml".
> [INFO] ------------------------------------------------------------
> ------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------
> ------------
> [INFO] Total time: 9.535 s
> [INFO] Finished at: 2014-12-16T17:18:11-07:00
> [INFO] Final Memory: 13M/218M
> [INFO] ------------------------------------------------------------
> ------------
> [ERROR] Failed to execute goal org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance
> (enhancer) on project webdirectory: Execution enhancer of goal
> org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance failed:
> org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.ClassCastException:
> org.apache.xerces.parsers.XML11Configuration cannot be cast to
> org.apache.xerces.xni.parser.XMLParserConfiguration -> [Help 1]
>
> I've been googling, and trying to debug this for awhile, and just don't
> know what it is.  Any ideas?
>
> Maven plugin configuration below.
>
>       <plugin>
>         <groupId>org.codehaus.mojo</groupId>
>         <artifactId>openjpa-maven-plugin</artifactId>
>         <version>1.1</version>
>         <configuration>
>           <includes>**/entities/*.class</includes>
>           <excludes>**/entities/XML*.class</excludes>
> <addDefaultConstructor>true</addDefaultConstructor>
> <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
>         </configuration>
>         <executions>
>           <execution>
>             <id>enhancer</id>
>             <phase>process-classes</phase>
>             <goals>
>               <goal>enhance</goal>
>             </goals>
>           </execution>
>         </executions>
>         <dependencies>
>           <dependency>
>             <groupId>org.apache.openjpa</groupId>
>             <artifactId>openjpa-all</artifactId>
>             <version>2.3.0</version>
>           </dependency>
>         </dependencies>
>       </plugin>
>


-- 
*Rick Curtis*