Hi,
I'm migrating from OpenJPA version id: openjpa-1.0.0-SNAPSHOT-r420667:559353
to openjpa-1.0.0 and I'm not able run the application with the same set of
procedures I used earlier(i.e. enhance entities and run).
I've enhanced the entities after compilation, and disabled the runtime
enhancement to achieve faster boot up by setting property '
openjpa.RuntimeClassOptimization' to 'false'. (PS. I'm using Java6 and
Spring-2.0.6).
But I get the following exception when the entity manager is created.
<openjpa-0.0.0-r420667:568173 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: This configuration
disallows runtime optimization, but the following listed types were not
enhanced at build time or at class load time with a javaagent: "[all classes
listed in persistence.xml]".
at
org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(
ManagedClassSubclasser.java:87)
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:597)
at org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(
AbstractBrokerFactory.java:287)
at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(
AbstractBrokerFactory.java:197)
at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(
DelegatingBrokerFactory.java:142)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(
EntityManagerFactoryImpl.java:192)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(
EntityManagerFactoryImpl.java:145)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(
EntityManagerFactoryImpl.java:56)
at
org.springframework.orm.jpa.JpaTransactionManager.createEntityManagerForTransaction
(JpaTransactionManager.java:391)
I think, all entities are already enhanced properly, as it works with the
earlier version of OpenJPA. I'm justing calling
org.apache.openjpa.enhance.PCEnhancer on the project in eclipse with
META-INF/persistence.xml being in the classpath.
Is there any other parameters which are mandatory to enhance the classes?
I didn't try with RuntimeClassOptimization allowed as it was also throwing
exceptions(I had posted earlier about this)
<openjpa-0.0.0-r420667:564688 fatal general error>
org.apache.openjpa.persistence.PersistenceException:
com.sun.tools.attach.VirtualMachine
at org.apache.openjpa.enhance.ClassRedefiner.redefineClasses(
ClassRedefiner.java:111)
at
org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(
ManagedClassSubclasser.java:124)
...
Caused by: java.lang.ClassNotFoundException:
com.sun.tools.attach.VirtualMachine
...
Could anybody please tell me the steps needed to run OpenJPA without
RuntimeClassOptimization.
Thanks,
Prashant