ClassNotFoundException: org.apache.openjpa.persistence.PersistenceProviderImpl

2013-11-02 Thread Matthias Wessendorf
Hello!

On trunk, when removing the provider element of the persistence.xml ([1])
the openejb-core-hibernate module assumes that the OpenJPA impl. should be
used.


However, the test here fails, since it can not find the OpenJPA
implementation; See stacktrace below.


-Matthias

[1]
https://github.com/apache/tomee/blob/trunk/examples/jpa-hibernate/src/main/resources/META-INF/persistence.xml#L24



org.apache.openejb.OpenEjbContainer$AssembleApplicationException:
org.apache.openejb.OpenEJBException: Creating application failed:
/Users/matzew/TEMP/TomEE/examples/jpa-hibernate:
org.apache.openejb.OpenEJBRuntimeException:
java.lang.ClassNotFoundException:
org.apache.openjpa.persistence.PersistenceProviderImpl:
java.lang.ClassNotFoundException:
org.apache.openjpa.persistence.PersistenceProviderImpl
at
org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:419)
at
javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
at org.superbiz.injection.h3jpa.MoviesTest.test(MoviesTest.java:37)
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:601)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
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:601)
at
org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
at
org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
at
org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
at
org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
Caused by: org.apache.openejb.OpenEJBException: Creating application
failed: /Users/matzew/TEMP/TomEE/examples/jpa-hibernate:
org.apache.openejb.OpenEJBRuntimeException:
java.lang.ClassNotFoundException:
org.apache.openjpa.persistence.PersistenceProviderImpl:
java.lang.ClassNotFoundException:
org.apache.openjpa.persistence.PersistenceProviderImpl
at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:897)
at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:612)
at
org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:415)
... 27 more
Caused by: org.apache.openejb.OpenEJBException:
org.apache.openejb.OpenEJBRuntimeException:
java.lang.ClassNotFoundException:
org.apache.openjpa.persistence.PersistenceProviderImpl:
java.lang.ClassNotFoundException:
org.apache.openjpa.persistence.PersistenceProviderImpl
at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:758)
... 29 more
Caused by: org.apache.openejb.OpenEJBRuntimeException:
java.lang.ClassNotFoundException:
org.apache.openjpa.persistence.PersistenceProviderImpl
at
org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createDelegate(ReloadableEntityManagerFactory.java:117)
at
org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.init(ReloadableEntityManagerFactory.java:101)
at
org.apache.openejb.assembler.classic.PersistenceBuilder.createEntityManagerFactory(PersistenceBuilder.java:150)
at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:752)
... 29 more
Caused by: java.lang.ClassNotFoundException:
org.apache.openjpa.persistence.PersistenceProviderImpl
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)

Re: ClassNotFoundException: org.apache.openjpa.persistence.PersistenceProviderImpl

2013-11-02 Thread Jean-Louis MONTEIRO
Hi Matthias,

The openejb-core-hibernate is just a helper pom.
It aims at providing a easy way from an end user point of view to use
Hibernate as the JPA provider instead of OpenJPA by default.

The pom just excludes OpenJPA and includes Hibernate.
If you wanna use OpenJPA, you have to use openejb-core instead of
openejb-core-hibernate.

Hope it helps
JLouis



2013/11/3 Matthias Wessendorf mat...@apache.org

 Hello!

 On trunk, when removing the provider element of the persistence.xml ([1])
 the openejb-core-hibernate module assumes that the OpenJPA impl. should be
 used.


 However, the test here fails, since it can not find the OpenJPA
 implementation; See stacktrace below.


 -Matthias

 [1]

 https://github.com/apache/tomee/blob/trunk/examples/jpa-hibernate/src/main/resources/META-INF/persistence.xml#L24



 org.apache.openejb.OpenEjbContainer$AssembleApplicationException:
 org.apache.openejb.OpenEJBException: Creating application failed:
 /Users/matzew/TEMP/TomEE/examples/jpa-hibernate:
 org.apache.openejb.OpenEJBRuntimeException:
 java.lang.ClassNotFoundException:
 org.apache.openjpa.persistence.PersistenceProviderImpl:
 java.lang.ClassNotFoundException:
 org.apache.openjpa.persistence.PersistenceProviderImpl
 at

 org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:419)
 at
 javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
 at org.superbiz.injection.h3jpa.MoviesTest.test(MoviesTest.java:37)
 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:601)
 at junit.framework.TestCase.runTest(TestCase.java:168)
 at junit.framework.TestCase.runBare(TestCase.java:134)
 at junit.framework.TestResult$1.protect(TestResult.java:110)
 at junit.framework.TestResult.runProtected(TestResult.java:128)
 at junit.framework.TestResult.run(TestResult.java:113)
 at junit.framework.TestCase.run(TestCase.java:124)
 at junit.framework.TestSuite.runTest(TestSuite.java:243)
 at junit.framework.TestSuite.run(TestSuite.java:238)
 at

 org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
 at

 org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
 at

 org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
 at

 org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
 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:601)
 at

 org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
 at

 org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
 at

 org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
 at

 org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
 at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
 Caused by: org.apache.openejb.OpenEJBException: Creating application
 failed: /Users/matzew/TEMP/TomEE/examples/jpa-hibernate:
 org.apache.openejb.OpenEJBRuntimeException:
 java.lang.ClassNotFoundException:
 org.apache.openjpa.persistence.PersistenceProviderImpl:
 java.lang.ClassNotFoundException:
 org.apache.openjpa.persistence.PersistenceProviderImpl
 at

 org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:897)
 at

 org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:612)
 at

 org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:415)
 ... 27 more
 Caused by: org.apache.openejb.OpenEJBException:
 org.apache.openejb.OpenEJBRuntimeException:
 java.lang.ClassNotFoundException:
 org.apache.openjpa.persistence.PersistenceProviderImpl:
 java.lang.ClassNotFoundException:
 org.apache.openjpa.persistence.PersistenceProviderImpl
 at

 org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:758)
 ... 29 more
 Caused by: org.apache.openejb.OpenEJBRuntimeException:
 java.lang.ClassNotFoundException:
 org.apache.openjpa.persistence.PersistenceProviderImpl
 at

 org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createDelegate(ReloadableEntityManagerFactory.java:117)
 at

 org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.init(ReloadableEntityManagerFactory.java:101)
 at

 org.apache.openejb.assembler.classic.PersistenceBuilder.createEntityManagerFactory(PersistenceBuilder.java:150)
 at

 org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:752)
 

Re: ClassNotFoundException: org.apache.openjpa.persistence.PersistenceProviderImpl

2013-11-02 Thread John D. Ament
Also, I believe this is expected behavior per EE specs.  The container may
have a default provider, which an app can leverage.  In containers like
WebLogic, you can configure a different default but that requires specific
configuration.

Maybe it's possible to configure OpenEJB/TomEE to have a default provider
other than OpenJPA, but I'm not sure how you would package that.


On Sat, Nov 2, 2013 at 7:29 PM, Jean-Louis MONTEIRO jeano...@gmail.comwrote:

 Hi Matthias,

 The openejb-core-hibernate is just a helper pom.
 It aims at providing a easy way from an end user point of view to use
 Hibernate as the JPA provider instead of OpenJPA by default.

 The pom just excludes OpenJPA and includes Hibernate.
 If you wanna use OpenJPA, you have to use openejb-core instead of
 openejb-core-hibernate.

 Hope it helps
 JLouis



 2013/11/3 Matthias Wessendorf mat...@apache.org

  Hello!
 
  On trunk, when removing the provider element of the persistence.xml
 ([1])
  the openejb-core-hibernate module assumes that the OpenJPA impl. should
 be
  used.
 
 
  However, the test here fails, since it can not find the OpenJPA
  implementation; See stacktrace below.
 
 
  -Matthias
 
  [1]
 
 
 https://github.com/apache/tomee/blob/trunk/examples/jpa-hibernate/src/main/resources/META-INF/persistence.xml#L24
 
 
 
  org.apache.openejb.OpenEjbContainer$AssembleApplicationException:
  org.apache.openejb.OpenEJBException: Creating application failed:
  /Users/matzew/TEMP/TomEE/examples/jpa-hibernate:
  org.apache.openejb.OpenEJBRuntimeException:
  java.lang.ClassNotFoundException:
  org.apache.openjpa.persistence.PersistenceProviderImpl:
  java.lang.ClassNotFoundException:
  org.apache.openjpa.persistence.PersistenceProviderImpl
  at
 
 
 org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:419)
  at
 
 javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
  at org.superbiz.injection.h3jpa.MoviesTest.test(MoviesTest.java:37)
  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:601)
  at junit.framework.TestCase.runTest(TestCase.java:168)
  at junit.framework.TestCase.runBare(TestCase.java:134)
  at junit.framework.TestResult$1.protect(TestResult.java:110)
  at junit.framework.TestResult.runProtected(TestResult.java:128)
  at junit.framework.TestResult.run(TestResult.java:113)
  at junit.framework.TestCase.run(TestCase.java:124)
  at junit.framework.TestSuite.runTest(TestSuite.java:243)
  at junit.framework.TestSuite.run(TestSuite.java:238)
  at
 
 
 org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
  at
 
 
 org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
  at
 
 
 org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
  at
 
 
 org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
  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:601)
  at
 
 
 org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
  at
 
 
 org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
  at
 
 
 org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
  at
 
 
 org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
  at
 org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
  Caused by: org.apache.openejb.OpenEJBException: Creating application
  failed: /Users/matzew/TEMP/TomEE/examples/jpa-hibernate:
  org.apache.openejb.OpenEJBRuntimeException:
  java.lang.ClassNotFoundException:
  org.apache.openjpa.persistence.PersistenceProviderImpl:
  java.lang.ClassNotFoundException:
  org.apache.openjpa.persistence.PersistenceProviderImpl
  at
 
 
 org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:897)
  at
 
 
 org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:612)
  at
 
 
 org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:415)
  ... 27 more
  Caused by: org.apache.openejb.OpenEJBException:
  org.apache.openejb.OpenEJBRuntimeException:
  java.lang.ClassNotFoundException:
  org.apache.openjpa.persistence.PersistenceProviderImpl:
  java.lang.ClassNotFoundException:
  org.apache.openjpa.persistence.PersistenceProviderImpl
  at
 
 
 org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:758)
  ... 29 more
  Caused