Hi Rick,
DynamicAgent complains (stack trace appended)
java.util.MissingResourceException:
C:\projects\TestOpenJPA\META-INF\persistence.xml#xml-persistence-unit
but C:\projects\TestOpenJPA\META-INF\persistence.xml has no unit named
"xml-persistence-unit".
and the code is down to the basic minimum
EntityManagerFactory emf =
OpenJPAPersistence.createEntityManagerFactory("named-query","META-INF/persistence.xml");
Of course, few other persistence.xml is hanging around in the classpath
and one of them surely has a unit named "xml-persistence-unit".
Switching off DynamicAgent works.
While you are it, please note that a better alternative to
Configurations.getFullyQualifiedAnchorsInPropertiesLocation(opts) (which is
a late addition) will simplify matters. I had seen difficult to trace errors
rooted in that method.
java.util.MissingResourceException:
C:\projects\TestOpenJPA\META-INF\persistence.xml#xml-persistence-unit
at
org.apache.openjpa.lib.conf.ProductDerivations.load(ProductDerivations.java:323)
at
org.apache.openjpa.lib.conf.Configurations.populateConfiguration(Configurations.java:339)
at
org.apache.openjpa.enhance.PCEnhancerAgent.registerClassLoadEnhancer(PCEnhancerAgent.java:164)
at
org.apache.openjpa.enhance.PCEnhancerAgent.premain(PCEnhancerAgent.java:144)
at
org.apache.openjpa.enhance.PCEnhancerAgent.loadDynamicAgent(PCEnhancerAgent.java:98)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.loadAgent(PersistenceProviderImpl.java:243)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:91)
at
org.apache.openjpa.persistence.OpenJPAPersistence.createEntityManagerFactory(OpenJPAPersistence.java:129)
at
org.apache.openjpa.persistence.OpenJPAPersistence.createEntityManagerFactory(OpenJPAPersistence.java:111)
Are you seeing these when running through the OpenJPA UT bucket, or when
you're running some other local tests? Perhaps you have some PUs defined
somewhere along your classpath that doesn't have any persistent classes
listed?
You could try disabling the changes I made
openjpa.DynamiceEnhancementAgent=false, to see if that makes a difference.
-----
Pinaki Poddar http://ppoddar.blogspot.com/
http://www.linkedin.com/in/pinakipoddar
OpenJPA PMC Member/Committer
JPA Expert Group Member
--
View this message in context:
http://n2.nabble.com/Dynamic-class-enhancer-and-Java-5-tp3031106p3033096.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.