Re: OpenJPA 3 and Karaf 4.2
Hi Matteo, that was my question about the name in the persistence.xml: as you use a JNDI name, you have to install the JNDI feature. Happy it works. Regards JB On 07/01/2019 21:55, Matteo Rulli wrote: > The jndi feature! That did the trick! > > Thank you Francois and Jean-Baptiste for your help and support. > > And thanks to the Karaf team for the new 4.2.x line ☺. > > Best regards, > Matteo > >> On 7 Jan 2019, at 18:43, francois.papon > <mailto:francois.pa...@openobject.fr>> wrote: >> >> Hi, >> >> Did you installed the "jndi" feature? >> >> Regards, >> >> Francois >> >> >> >> Envoyé depuis mon smartphone Samsung Galaxy. >> >> Message d'origine >> De : Matteo Rulli > <mailto:matteo.ru...@gmail.com>> >> Date : 07/01/2019 21:34 (GMT+04:00) >> À : user@karaf.apache.org <mailto:user@karaf.apache.org> >> Objet : Re: OpenJPA 3 and Karaf 4.2 >> >> Hi! >> >> Thank you for the feedback. >> >> It seems the persistence unit name is ok. The blueprint component is >> correctly wired with the services: >> >> karaf@root()> services -u myjpaservice.impl >> >> myjpaservice.impl (18) uses: >> >> [javax.persistence.spi.PersistenceProvider] >> [javax.sql.DataSource] >> [javax.persistence.EntityManagerFactory] >> [javax.transaction.TransactionManager, >> javax.transaction.TransactionSynchronizationRegistry, >> javax.transaction.UserTransaction, >> org.apache.geronimo.transaction.manager.RecoverableTransactionManager] >> >> And both EntityManager and TransactionManager are available on the >> service registry: >> >> karaf@root()> service:list EntityManager >> [javax.persistence.EntityManager] >> - >> osgi.unit.name = myPersistenceUnit >> service.bundleid = 18 >> service.id <http://service.id/> = 147 >> service.scope = singleton >> Provided by : >> myjpaservice.impl (18) >> >> karaf@root()> service:list TransactionManager >> [javax.transaction.TransactionManager, >> javax.transaction.TransactionSynchronizationRegistry, >> javax.transaction.UserTransaction, >> org.apache.geronimo.transaction.manager.RecoverableTransactionManager] >> -- >> service.bundleid = 110 >> service.id <http://service.id/> = 124 >> service.scope = singleton >> Provided by : >> pax-transx-tm-geronimo (110) >> Used by: >> OpenJPA Aggregate Jar (69) >> OPS4J Pax JDBC Pooling DBCP2 (101) >> myjpaservice.impl (18) >> >> [org.ops4j.pax.transx.tm.TransactionManager] >> >> service.bundleid = 110 >> service.id <http://service.id/> = 126 >> service.scope = singleton >> Provided by : >> pax-transx-tm-geronimo (110) >> >> Besides, the tables in the postgresqlDB database are correctly created >> during pax-exam test boot-up: that should be a sign that the pax-jdbc >> and JPA are running and well configured, right? The test fails as soon >> as the injected entityManager is used, spitting out the stacktrace below. >> >> Could you please suggest what else I can check to identify what the >> problem could be? The same project works fine with the previous >> version of Karaf and OpenJPA: could the problem be triggered by some >> version incompatibilities like the one you mentioned in your previous >> email? >> >> Thank you very much, >> Matteo >> >> >> Complete stack trace: >> >> 18:26:02,645 | WARN | ion(3)-127.0.0.1 | JpaInterceptor >> | 29 - org.apache.aries.jpa.blueprint - 2.7.0 | Exception from >> EmSupplier.preCall >> java.lang.reflect.UndeclaredThrowableException: null >> at com.sun.proxy.$Proxy70.createEntityManager(Unknown Source) ~[?:?] >> at >> org.apache.aries.jpa.support.impl.EMSupplierImpl.createEm(EMSupplierImpl.java:68) >> ~[?:?] >> at >> org.apache.aries.jpa.support.impl.EMSupplierImpl.get(EMSupplierImpl.java:86) >> ~[?:?] >> at >> org.apache.aries.jpa.support.osgi.impl.EmProxy.invoke(EmProxy.java:38) >> ~[?:?] >> at com.sun.proxy.$Proxy71.getProperties(Unknown Source) ~[?:?] >> at Proxy6f73aaf4_20c4_4127_846f_6f5c625740c9.getProperties(Unknown &
Re: OpenJPA 3 and Karaf 4.2
Happy to see it works :) Regards, François Papon fpa...@apache.org Le 08/01/2019 à 00:55, Matteo Rulli a écrit : > The jndi feature! That did the trick! > > Thank you Francois and Jean-Baptiste for your help and support. > > And thanks to the Karaf team for the new 4.2.x line ☺. > > Best regards, > Matteo > >> On 7 Jan 2019, at 18:43, francois.papon > <mailto:francois.pa...@openobject.fr>> wrote: >> >> Hi, >> >> Did you installed the "jndi" feature? >> >> Regards, >> >> Francois >> >> >> >> Envoyé depuis mon smartphone Samsung Galaxy. >> >> Message d'origine >> De : Matteo Rulli > <mailto:matteo.ru...@gmail.com>> >> Date : 07/01/2019 21:34 (GMT+04:00) >> À : user@karaf.apache.org <mailto:user@karaf.apache.org> >> Objet : Re: OpenJPA 3 and Karaf 4.2 >> >> Hi! >> >> Thank you for the feedback. >> >> It seems the persistence unit name is ok. The blueprint component is >> correctly wired with the services: >> >> karaf@root()> services -u myjpaservice.impl >> >> myjpaservice.impl (18) uses: >> >> [javax.persistence.spi.PersistenceProvider] >> [javax.sql.DataSource] >> [javax.persistence.EntityManagerFactory] >> [javax.transaction.TransactionManager, >> javax.transaction.TransactionSynchronizationRegistry, >> javax.transaction.UserTransaction, >> org.apache.geronimo.transaction.manager.RecoverableTransactionManager] >> >> And both EntityManager and TransactionManager are available on the >> service registry: >> >> karaf@root()> service:list EntityManager >> [javax.persistence.EntityManager] >> - >> osgi.unit.name = myPersistenceUnit >> service.bundleid = 18 >> service.id <http://service.id/> = 147 >> service.scope = singleton >> Provided by : >> myjpaservice.impl (18) >> >> karaf@root()> service:list TransactionManager >> [javax.transaction.TransactionManager, >> javax.transaction.TransactionSynchronizationRegistry, >> javax.transaction.UserTransaction, >> org.apache.geronimo.transaction.manager.RecoverableTransactionManager] >> -- >> service.bundleid = 110 >> service.id <http://service.id/> = 124 >> service.scope = singleton >> Provided by : >> pax-transx-tm-geronimo (110) >> Used by: >> OpenJPA Aggregate Jar (69) >> OPS4J Pax JDBC Pooling DBCP2 (101) >> myjpaservice.impl (18) >> >> [org.ops4j.pax.transx.tm.TransactionManager] >> >> service.bundleid = 110 >> service.id <http://service.id/> = 126 >> service.scope = singleton >> Provided by : >> pax-transx-tm-geronimo (110) >> >> Besides, the tables in the postgresqlDB database are correctly >> created during pax-exam test boot-up: that should be a sign that the >> pax-jdbc and JPA are running and well configured, right? The test >> fails as soon as the injected entityManager is used, spitting out the >> stacktrace below. >> >> Could you please suggest what else I can check to identify what the >> problem could be? The same project works fine with the previous >> version of Karaf and OpenJPA: could the problem be triggered by some >> version incompatibilities like the one you mentioned in your previous >> email? >> >> Thank you very much, >> Matteo >> >> >> Complete stack trace: >> >> 18:26:02,645 | WARN | ion(3)-127.0.0.1 | JpaInterceptor >> | 29 - org.apache.aries.jpa.blueprint - 2.7.0 | Exception from >> EmSupplier.preCall >> java.lang.reflect.UndeclaredThrowableException: null >> at com.sun.proxy.$Proxy70.createEntityManager(Unknown Source) ~[?:?] >> at >> org.apache.aries.jpa.support.impl.EMSupplierImpl.createEm(EMSupplierImpl.java:68) >> ~[?:?] >> at >> org.apache.aries.jpa.support.impl.EMSupplierImpl.get(EMSupplierImpl.java:86) >> ~[?:?] >> at >> org.apache.aries.jpa.support.osgi.impl.EmProxy.invoke(EmProxy.java:38) >> ~[?:?] >> at com.sun.proxy.$Proxy71.getProperties(Unknown Source) ~[?:?] >> at Proxy6f73aaf4_20c4_4127_846f_6f5c625740c9.getProperties(Unknown >> Source) ~[?:?] >> at >> org.apache.aries.jpa.blueprint.impl.JpaInterceptor.
Re: OpenJPA 3 and Karaf 4.2
The jndi feature! That did the trick! Thank you Francois and Jean-Baptiste for your help and support. And thanks to the Karaf team for the new 4.2.x line ☺. Best regards, Matteo > On 7 Jan 2019, at 18:43, francois.papon wrote: > > Hi, > > Did you installed the "jndi" feature? > > Regards, > > Francois > > > > Envoyé depuis mon smartphone Samsung Galaxy. > > Message d'origine > De : Matteo Rulli > Date : 07/01/2019 21:34 (GMT+04:00) > À : user@karaf.apache.org > Objet : Re: OpenJPA 3 and Karaf 4.2 > > Hi! > > Thank you for the feedback. > > It seems the persistence unit name is ok. The blueprint component is > correctly wired with the services: > > karaf@root()> services -u myjpaservice.impl > > myjpaservice.impl (18) uses: > > [javax.persistence.spi.PersistenceProvider] > [javax.sql.DataSource] > [javax.persistence.EntityManagerFactory] > [javax.transaction.TransactionManager, > javax.transaction.TransactionSynchronizationRegistry, > javax.transaction.UserTransaction, > org.apache.geronimo.transaction.manager.RecoverableTransactionManager] > > And both EntityManager and TransactionManager are available on the service > registry: > > karaf@root()> service:list EntityManager > [javax.persistence.EntityManager] > - > osgi.unit.name = myPersistenceUnit > service.bundleid = 18 > service.id <http://service.id/> = 147 > service.scope = singleton > Provided by : > myjpaservice.impl (18) > > karaf@root()> service:list TransactionManager > [javax.transaction.TransactionManager, > javax.transaction.TransactionSynchronizationRegistry, > javax.transaction.UserTransaction, > org.apache.geronimo.transaction.manager.RecoverableTransactionManager] > -- > service.bundleid = 110 > service.id <http://service.id/> = 124 > service.scope = singleton > Provided by : > pax-transx-tm-geronimo (110) > Used by: > OpenJPA Aggregate Jar (69) > OPS4J Pax JDBC Pooling DBCP2 (101) > myjpaservice.impl (18) > > [org.ops4j.pax.transx.tm.TransactionManager] > > service.bundleid = 110 > service.id <http://service.id/> = 126 > service.scope = singleton > Provided by : > pax-transx-tm-geronimo (110) > > Besides, the tables in the postgresqlDB database are correctly created during > pax-exam test boot-up: that should be a sign that the pax-jdbc and JPA are > running and well configured, right? The test fails as soon as the injected > entityManager is used, spitting out the stacktrace below. > > Could you please suggest what else I can check to identify what the problem > could be? The same project works fine with the previous version of Karaf and > OpenJPA: could the problem be triggered by some version incompatibilities > like the one you mentioned in your previous email? > > Thank you very much, > Matteo > > > Complete stack trace: > > 18:26:02,645 | WARN | ion(3)-127.0.0.1 | JpaInterceptor | > 29 - org.apache.aries.jpa.blueprint - 2.7.0 | Exception from > EmSupplier.preCall > java.lang.reflect.UndeclaredThrowableException: null > at com.sun.proxy.$Proxy70.createEntityManager(Unknown Source) ~[?:?] > at > org.apache.aries.jpa.support.impl.EMSupplierImpl.createEm(EMSupplierImpl.java:68) > ~[?:?] > at > org.apache.aries.jpa.support.impl.EMSupplierImpl.get(EMSupplierImpl.java:86) > ~[?:?] > at > org.apache.aries.jpa.support.osgi.impl.EmProxy.invoke(EmProxy.java:38) ~[?:?] > at com.sun.proxy.$Proxy71.getProperties(Unknown Source) ~[?:?] > at Proxy6f73aaf4_20c4_4127_846f_6f5c625740c9.getProperties(Unknown > Source) ~[?:?] > at > org.apache.aries.jpa.blueprint.impl.JpaInterceptor.isResourceLocalInternal(JpaInterceptor.java:109) > ~[?:?] > at > org.apache.aries.jpa.blueprint.impl.JpaInterceptor.isResourceLocal(JpaInterceptor.java:99) > ~[?:?] > at > org.apache.aries.jpa.blueprint.impl.JpaInterceptor.preCall(JpaInterceptor.java:62) > ~[?:?] > at > org.apache.aries.blueprint.proxy.Collaborator.preInvoke(Collaborator.java:73) > ~[?:?] > at Proxy2b756db4_920f_4f1f_ab3f_93eac79d479c.addEntity(Unknown Source) > ~[?:?] > at > com.flairbit.examples.postgresjpa.TestModule.testCase(TestModule.java:118) > ~[?:?] > at sun.reflect.NativeMethodAcce
Re: OpenJPA 3 and Karaf 4.2
Hi, Did you installed the "jndi" feature? Regards, Francois Envoyé depuis mon smartphone Samsung Galaxy. Message d'origine De : Matteo Rulli Date : 07/01/2019 21:34 (GMT+04:00) À : user@karaf.apache.org Objet : Re: OpenJPA 3 and Karaf 4.2 Hi! Thank you for the feedback. It seems the persistence unit name is ok. The blueprint component is correctly wired with the services: karaf@root()> services -u myjpaservice.impl myjpaservice.impl (18) uses:[javax.persistence.spi.PersistenceProvider][javax.sql.DataSource][javax.persistence.EntityManagerFactory][javax.transaction.TransactionManager, javax.transaction.TransactionSynchronizationRegistry, javax.transaction.UserTransaction, org.apache.geronimo.transaction.manager.RecoverableTransactionManager] And both EntityManager and TransactionManager are available on the service registry: karaf@root()> service:list EntityManager[javax.persistence.EntityManager]- osgi.unit.name = myPersistenceUnit service.bundleid = 18 service.id = 147 service.scope = singletonProvided by : myjpaservice.impl (18) karaf@root()> service:list TransactionManager[javax.transaction.TransactionManager, javax.transaction.TransactionSynchronizationRegistry, javax.transaction.UserTransaction, org.apache.geronimo.transaction.manager.RecoverableTransactionManager]-- service.bundleid = 110 service.id = 124 service.scope = singletonProvided by : pax-transx-tm-geronimo (110)Used by: OpenJPA Aggregate Jar (69) OPS4J Pax JDBC Pooling DBCP2 (101) myjpaservice.impl (18) [org.ops4j.pax.transx.tm.TransactionManager] service.bundleid = 110 service.id = 126 service.scope = singletonProvided by : pax-transx-tm-geronimo (110) Besides, the tables in the postgresqlDB database are correctly created during pax-exam test boot-up: that should be a sign that the pax-jdbc and JPA are running and well configured, right? The test fails as soon as the injected entityManager is used, spitting out the stacktrace below. Could you please suggest what else I can check to identify what the problem could be? The same project works fine with the previous version of Karaf and OpenJPA: could the problem be triggered by some version incompatibilities like the one you mentioned in your previous email? Thank you very much,Matteo Complete stack trace: 18:26:02,645 | WARN | ion(3)-127.0.0.1 | JpaInterceptor | 29 - org.apache.aries.jpa.blueprint - 2.7.0 | Exception from EmSupplier.preCalljava.lang.reflect.UndeclaredThrowableException: null at com.sun.proxy.$Proxy70.createEntityManager(Unknown Source) ~[?:?]at org.apache.aries.jpa.support.impl.EMSupplierImpl.createEm(EMSupplierImpl.java:68) ~[?:?] at org.apache.aries.jpa.support.impl.EMSupplierImpl.get(EMSupplierImpl.java:86) ~[?:?] at org.apache.aries.jpa.support.osgi.impl.EmProxy.invoke(EmProxy.java:38) ~[?:?] at com.sun.proxy.$Proxy71.getProperties(Unknown Source) ~[?:?] at Proxy6f73aaf4_20c4_4127_846f_6f5c625740c9.getProperties(Unknown Source) ~[?:?] at org.apache.aries.jpa.blueprint.impl.JpaInterceptor.isResourceLocalInternal(JpaInterceptor.java:109) ~[?:?] at org.apache.aries.jpa.blueprint.impl.JpaInterceptor.isResourceLocal(JpaInterceptor.java:99) ~[?:?]at org.apache.aries.jpa.blueprint.impl.JpaInterceptor.preCall(JpaInterceptor.java:62) ~[?:?]at org.apache.aries.blueprint.proxy.Collaborator.preInvoke(Collaborator.java:73) ~[?:?] at Proxy2b756db4_920f_4f1f_ab3f_93eac79d479c.addEntity(Unknown Source) ~[?:?] at com.flairbit.examples.postgresjpa.TestModule.testCase(TestModule.java:118) ~[?:?]at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?] at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) ~[?:?] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) ~[?:?] at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) ~[?:?]at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) ~[?:?] at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) ~[?:?] at org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runLeafWithRetry(ContainerTestRunner.java:97) ~[?:?] at org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChildWithRetry(Containe
Re: OpenJPA 3 and Karaf 4.2
kernel.BrokerImpl.initialize(BrokerImpl.java:399) > ~[?:?] > at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:325) > ~[?:?] > at > org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:228) > ~[?:?] > at > org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212) > ~[?:?] > at > org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:154) > ~[?:?] > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:246) > ~[?:?] > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:162) > ~[?:?] > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:152) > ~[?:?] > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:58) > ~[?:?] > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > ~[?:?] > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > ~[?:?] > at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?] > at > org.apache.aries.jpa.container.impl.AriesEntityManagerFactoryBuilder$2.invoke(AriesEntityManagerFactoryBuilder.java:395) > ~[?:?] > ... 58 more > Caused by: javax.naming.NoInitialContextException: Need to specify class > name in environment or system property, or as an applet parameter, or in > an application resource file: java.naming.factory.initial > at > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662) > ~[?:?] > at > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313) > ~[?:?] > at > javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:350) > ~[?:?] > at javax.naming.InitialContext.lookup(InitialContext.java:417) ~[?:?] > at > org.apache.openjpa.ee.RegistryManagedRuntime.getTransactionManager(RegistryManagedRuntime.java:63) > ~[?:?] > at > org.apache.openjpa.ee.AutomaticManagedRuntime.getTransactionManager(AutomaticManagedRuntime.java:171) > ~[?:?] > at > org.apache.openjpa.kernel.AbstractBrokerFactory.syncWithManagedTransaction(AbstractBrokerFactory.java:728) > ~[?:?] > at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:399) > ~[?:?] > at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:325) > ~[?:?] > at > org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:228) > ~[?:?] > at > org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212) > ~[?:?] > at > org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:154) > ~[?:?] > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:246) > ~[?:?] > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:162) > ~[?:?] > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:152) > ~[?:?] > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:58) > ~[?:?] > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > ~[?:?] > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > ~[?:?] > at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?] > at > org.apache.aries.jpa.container.impl.AriesEntityManagerFactoryBuilder$2.invoke(AriesEntityManagerFactoryBuilder.java:395) > ~[?:?] > ... 58 more > >> On 7 Jan 2019, at 16:01, Jean-Baptiste Onofré > <mailto:j...@nanthrax.net>> wrote: >> >> Hi Matteo, >> >> I just checked OpenJPA3 with JPA feature. The problem is about the >> javax.persistence version. Now, hibernate and eclipselink uses JPA 2.1 >> whereas OpenJPA uses JPA 2.2. >> >> So, we can have a ClassCastException while trying to deal with both >> version in the same container. >> >> That's what happening by default on the provided example. I'm >> improving it. >> >> Anyway, I don't reproduce the issue. I guess that problem is that you >> don't use the correct JNDI name in persistence.xml. >> >> Regards >> JB >> >> On 05/01/2019 22:42, Matteo Rulli wrote: >>> I tri
Re: OpenJPA 3 and Karaf 4.2
Hi Matteo, I just checked OpenJPA3 with JPA feature. The problem is about the javax.persistence version. Now, hibernate and eclipselink uses JPA 2.1 whereas OpenJPA uses JPA 2.2. So, we can have a ClassCastException while trying to deal with both version in the same container. That's what happening by default on the provided example. I'm improving it. Anyway, I don't reproduce the issue. I guess that problem is that you don't use the correct JNDI name in persistence.xml. Regards JB On 05/01/2019 22:42, Matteo Rulli wrote: > I tried to put together a project (here > <https://github.com/mrulli/myjpaservice>: > https://github.com/mrulli/myjpaservice) > to test how OpenJPA 3 and Karaf 4.2.x play together but I get the > following error: > > javax.naming.NoInitialContextException: Need to specify class name in > environment or system property, or as an applet parameter, or in an > application resource file: java.naming.factory.initial > at > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662) > ~[?:?] > at > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313) > ~[?:?] > at > javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:350) > ~[?:?] > at javax.naming.InitialContext.lookup(InitialContext.java:417) ~[?:?] > at > org.apache.openjpa.ee.RegistryManagedRuntime.getTransactionManager(RegistryManagedRuntime.java:63) > ~[?:?] > at > org.apache.openjpa.ee.AutomaticManagedRuntime.getTransactionManager(AutomaticManagedRuntime.java:171) > ~[?:?] > at > org.apache.openjpa.kernel.AbstractBrokerFactory.syncWithManagedTransaction(AbstractBrokerFactory.java:728) > ~[?:?] > at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:399) > ~[?:?] > at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:325) > ~[?:?] > at > org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:228) > ~[?:?] > at > org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212) > ~[?:?] > at > org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:154) > ~[?:?] > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:246) > ~[?:?] > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:162) > ~[?:?] > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:152) > ~[?:?] > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:58) > ~[?:?] > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > ~[?:?] > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > ~[?:?] > at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?] > at > org.apache.aries.jpa.container.impl.AriesEntityManagerFactoryBuilder$2.invoke(AriesEntityManagerFactoryBuilder.java:395) > ~[?:?] > ... 58 more > > A similar project works fine with OpenJPA 2.4.1 and Karaf 4.1. > > I saw an example project > <https://github.com/apache/karaf/blob/master/examples/karaf-jpa-example/karaf-jpa-example-features/src/main/feature/feature.xml> > in > Karaf repo but the openjpa case seems unsupported/commented out. Is > openjpa 3 supported in Karaf 4.2? > > Thank you for your help, > > Matteo > > -- Jean-Baptiste Onofré jbono...@apache.org http://blog.nanthrax.net Talend - http://www.talend.com
Re: OpenJPA 3 and Karaf 4.2
Hi Matteo, We did test and fixes in OpenJPA 3. So, it should work. AFAIR, openjpa feature is commented in the example because it failed in the tests on Jenkins. Let me try on the Karaf provided example. Regards JB On 05/01/2019 22:42, Matteo Rulli wrote: > I tried to put together a project (here > <https://github.com/mrulli/myjpaservice>: > https://github.com/mrulli/myjpaservice) > to test how OpenJPA 3 and Karaf 4.2.x play together but I get the > following error: > > javax.naming.NoInitialContextException: Need to specify class name in > environment or system property, or as an applet parameter, or in an > application resource file: java.naming.factory.initial > at > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662) > ~[?:?] > at > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313) > ~[?:?] > at > javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:350) > ~[?:?] > at javax.naming.InitialContext.lookup(InitialContext.java:417) ~[?:?] > at > org.apache.openjpa.ee.RegistryManagedRuntime.getTransactionManager(RegistryManagedRuntime.java:63) > ~[?:?] > at > org.apache.openjpa.ee.AutomaticManagedRuntime.getTransactionManager(AutomaticManagedRuntime.java:171) > ~[?:?] > at > org.apache.openjpa.kernel.AbstractBrokerFactory.syncWithManagedTransaction(AbstractBrokerFactory.java:728) > ~[?:?] > at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:399) > ~[?:?] > at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:325) > ~[?:?] > at > org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:228) > ~[?:?] > at > org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212) > ~[?:?] > at > org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:154) > ~[?:?] > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:246) > ~[?:?] > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:162) > ~[?:?] > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:152) > ~[?:?] > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:58) > ~[?:?] > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > ~[?:?] > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > ~[?:?] > at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?] > at > org.apache.aries.jpa.container.impl.AriesEntityManagerFactoryBuilder$2.invoke(AriesEntityManagerFactoryBuilder.java:395) > ~[?:?] > ... 58 more > > A similar project works fine with OpenJPA 2.4.1 and Karaf 4.1. > > I saw an example project > <https://github.com/apache/karaf/blob/master/examples/karaf-jpa-example/karaf-jpa-example-features/src/main/feature/feature.xml> > in > Karaf repo but the openjpa case seems unsupported/commented out. Is > openjpa 3 supported in Karaf 4.2? > > Thank you for your help, > > Matteo > > -- Jean-Baptiste Onofré jbono...@apache.org http://blog.nanthrax.net Talend - http://www.talend.com
OpenJPA 3 and Karaf 4.2
I tried to put together a project (here <https://github.com/mrulli/myjpaservice>: https://github.com/mrulli/myjpaservice) to test how OpenJPA 3 and Karaf 4.2.x play together but I get the following error: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662) ~[?:?] at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313) ~[?:?] at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:350) ~[?:?] at javax.naming.InitialContext.lookup(InitialContext.java:417) ~[?:?] at org.apache.openjpa.ee.RegistryManagedRuntime.getTransactionManager(RegistryManagedRuntime.java:63) ~[?:?] at org.apache.openjpa.ee.AutomaticManagedRuntime.getTransactionManager(AutomaticManagedRuntime.java:171) ~[?:?] at org.apache.openjpa.kernel.AbstractBrokerFactory.syncWithManagedTransaction(AbstractBrokerFactory.java:728) ~[?:?] at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:399) ~[?:?] at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:325) ~[?:?] at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:228) ~[?:?] at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212) ~[?:?] at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:154) ~[?:?] at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:246) ~[?:?] at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:162) ~[?:?] at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:152) ~[?:?] at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:58) ~[?:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?] at org.apache.aries.jpa.container.impl.AriesEntityManagerFactoryBuilder$2.invoke(AriesEntityManagerFactoryBuilder.java:395) ~[?:?] ... 58 more A similar project works fine with OpenJPA 2.4.1 and Karaf 4.1. I saw an example project <https://github.com/apache/karaf/blob/master/examples/karaf-jpa-example/karaf-jpa-example-features/src/main/feature/feature.xml> in Karaf repo but the openjpa case seems unsupported/commented out. Is openjpa 3 supported in Karaf 4.2? Thank you for your help, Matteo