The JPA API version that we bundle is JPA 1.0. Those classes are in the javaee-api.jar. It is possible to delete that jar and then use the individual libraries instead. There's a zip of them here:

   http://www.apache.org/dist/openejb/3.1.2/javaee-api-libs-3.1.2-src.zip

Then you can replace the jpa api jar with a JPA 2.0 version. I don't know if it will *work* as if there are new methods in the EntityManager interface, then likely there'll be vm errors complaining that we don't implement them. There are parts of JPA that the EJB container has to implement to support any @PersistenceContext injection.

So not sure if it will work, but it should be pretty quick to find out :)

Note, if it doesn't work, we might be able to find some sneaky way to support it in the next release. Any help is certainly welcome.

-David


On Nov 12, 2009, at 1:23 PM, PatLaPatate wrote:


Hi JL and David,

I was able to go forward. However, when I tried changing my persistence
provider to hibernate :
<provider>org.hibernate.ejb.HibernatePersistence</provider>

I get the following error:
org.apache.openejb.OpenEJBException: Creating application failed:
classpath.ear: javax/persistence/spi/ProviderUtil

I was wondering : Where can I find that class? I assumed it should be under
JPA 2.0... but it is not...

Is openEJB looking for some class provided in the latter version of JPA?

ERROR - Application could not be deployed:  classpath.ear
org.apache.openejb.OpenEJBException: Creating application failed:
classpath.ear: javax/persistence/spi/ProviderUtil
        at
org .apache .openejb .assembler.classic.Assembler.createApplication(Assembler.java:666)
        at
org .apache .openejb .assembler.classic.Assembler.createApplication(Assembler.java:449)
        at
org .apache .openejb .assembler.classic.Assembler.buildContainerSystem(Assembler.java:367) at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java: 279)
        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:137)
        at org.apache.openejb.OpenEJB.init(OpenEJB.java:286)
        at org.apache.openejb.OpenEJB.init(OpenEJB.java:265)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java: 36)
        at
org .apache .openejb .client .LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
        at
org .apache .openejb .client .LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
        at
org .apache .openejb .client .LocalInitialContextFactory .getInitialContext(LocalInitialContextFactory.java:42)
        at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
        at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
        at javax.naming.InitialContext.init(Unknown Source)
        at javax.naming.InitialContext.<init>(Unknown Source)
at com.desj.visa.app.cge.tests.CGEServiceTest.setUp(CGEServiceTest.java: 34)
        at junit.framework.TestCase.runBare(TestCase.java:125)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at
org .eclipse .jdt .internal .junit .runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
        at
org .eclipse .jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at
org .eclipse .jdt .internal .junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at
org .eclipse .jdt .internal .junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at
org .eclipse .jdt .internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at
org .eclipse .jdt .internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java: 196)
Caused by: java.lang.NoClassDefFoundError:
javax/persistence/spi/ProviderUtil
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
        at java.lang.Class.getConstructor0(Unknown Source)
        at java.lang.Class.newInstance0(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        at
org .apache .openejb .assembler .classic .PersistenceBuilder .createEntityManagerFactory(PersistenceBuilder.java:179)
        at
org .apache .openejb .assembler.classic.Assembler.createApplication(Assembler.java:489)
        ... 32 more
Caused by: java.lang.ClassNotFoundException:
javax.persistence.spi.ProviderUtil
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        ... 39 more


--
View this message in context: 
http://old.nabble.com/OutOfMemory-doing-a-JUnit-using-OpenEJB-Embedded-tp26289066p26326678.html
Sent from the OpenEJB User mailing list archive at Nabble.com.



Reply via email to