Class enhancing fails with custom persistence.xml
-------------------------------------------------
Key: MOJO-1322
URL: http://jira.codehaus.org/browse/MOJO-1322
Project: Mojo
Issue Type: Bug
Components: openjpa
Environment: OpenJPA 1.2.0 and 1.2.1., Eclipse Ganymede, Windows XP SP2
Reporter: Xavi Arias
Attachments: pom.xml, pom.xml
Hello,
The problem may come from class loading issue, I've tried with both OpenJPA
1.2.0 and 1.2.1. Debugging the Maven build, the load of the persistence file by
the PersistenceProductDerivation is done two times, first by a class loader
wich finds the resource META-INF/test/persistence.xml, and second by another
class loader wich fails to find the resource. The class loaders are stringfied
as:
ClassRealm[maven.plugin.openjpa, parent:
ClassRealm[/plugins/org.codehaus.mojo:openjpa-maven-plugin:1...@-2084258001/thread:main,
parent: ClassRealm[plexus.core, parent: null]]]
ClassRealm[/plugins/org.codehaus.mojo:openjpa-maven-plugin:1...@-2084258001/thread:main,
parent: ClassRealm[plexus.core, parent: null]]
I am not a class loading expert so I don't figure what is happening, but it
seems a problem in the class loading hierarchy. I have also tried to specify
the persistence unit as META-INF/test/persistence.xml#TestUnit, but the problem
persists. The resulting stack trace is:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building test
[INFO]
[INFO] Id: com.test:test:jar:1.1.3-SNAPSHOT
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [statemgmt:start-fork]
[INFO] Starting forked execution [fork id: 936249518]
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [statemgmt:end-fork]
[INFO] Ending forked execution [fork id: 936249518]
[INFO] [openjpa:enhance]
log4j:WARN No appenders could be found for logger (openjpa.Runtime).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.apache.openjpa.lib.util.ParseException:
org.apache.openjpa.conf.openjpaconfigurationi...@ccb6d6c2.properties =
META-INF/test/persistence.xml
at org.apache.openjpa.lib.util.Options.setInto(Options.java:237)
at org.apache.openjpa.lib.util.Options.setInto(Options.java:181)
at
org.apache.openjpa.lib.conf.Configurations.populateConfiguration(Configurations.java:357)
at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4439)
at org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4410)
at
org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708)
at
org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:698)
at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4405)
at
org.codehaus.mojo.openjpa.OpenJpaEnhancerMojo.enhance(OpenJpaEnhancerMojo.java:121)
at
org.codehaus.mojo.openjpa.OpenJpaEnhancerMojo.execute(OpenJpaEnhancerMojo.java:86)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:579)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:498)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycleExecutor.java:265)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:191)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)
at
org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
at
org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
at
org.apache.maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.java:904)
at
org.apache.maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbedder.java:304)
at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:52)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.openjpa.lib.util.Options.invoke(Options.java:401)
at org.apache.openjpa.lib.util.Options.setInto(Options.java:234)
... 23 more
Caused by: java.util.MissingResourceException:
META-INF/test/persistence.xml#null
at
org.apache.openjpa.lib.conf.ProductDerivations.load(ProductDerivations.java:272)
at
org.apache.openjpa.lib.conf.ConfigurationImpl.setProperties(ConfigurationImpl.java:762)
... 29 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email