You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Kevin Sutter <kw...@gmail.com> on 2014/12/01 22:41:06 UTC

Re: OpenJPA and auto-commit

Hi Charlie,
Since you are using SynchronizeMappings, you should be providing an
alternate datasource (non-jta-data-source) in addition to the
jta-data-source.  OpenJPA requires access to the database in order to
define or adjust your schemas based on your Entity definitions.  Without a
non-jta-data-source, OpenJPA will attempt to do this work within the global
transaction.  Unfortunately, the auto commit processing doesn't work well
within a global transaction (as you have found out).

Hope this helps.

Kevin

On Sun, Nov 30, 2014 at 9:05 AM, Charlie Mordant <cm...@gmail.com>
wrote:

> Hi OpenJPA Guru's,
>
> I'm encountering an issue when openJPA participates to a global
> transaction, I've got this weird error happening sometimes:
>
> Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException:
> setAutoCommit(true) invalid during global transaction.
>
>         at
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:559)
>
>         at
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
>
>
> My persistence.xml is as simple as it can be:
> [code]
>
> <persistence-unit name="${project.artifactId}Pu" transaction-type="JTA">
>
>
>  <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>
> <jta-data-source>osgi:service/javax.sql.DataSource/(&amp;(
> osgi.jndi.service.name
> =${project.parent.artifactId}.database)(aries.managed=true))</
> jta-data-source>
>
> <properties>
>
>  <property name="openjpa.Log" value="slf4j"/>
>
>  <property name="openjpa.jdbc.SynchronizeMappings" value=
> "buildSchema(ForeignKeys=true,SchemaAction=refresh)"/>
>
>  <property name="openjpa.jdbc.DBDictionary" value="derby"/>
>
> </persistence-unit>
> [/code]
>
> Is there any property/option to set somewhere?
>
> ​Regards,​
>
> --
> Charlie Mordant
>
> Full OSGI/EE stack made with Karaf:
> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
>

Re: OpenJPA and auto-commit

Posted by Bengt Rodehav <be...@rodehav.com>.
Hi Charlie,

I managed to get this problem fixed. I have discussed it in the Aries user
list:

http://mail-archives.apache.org/mod_mbox/aries-user/201607.mbox/%3CCAJ0TPGJjN0vD-6Rc5MUM0VdoeSwK9jBGYThL_b0KNoDdtyAZpg@mail.gmail.com%3E

In the end I replaced the "non-jta-datasource" property with the
"openjpa.ConnectionFactory2Name" property in my persistence.xml. My guess
(maybe you can confirm?) is that OpenJPA looks at the "jta-datasource" to
see whether it is a DataSource or a XADataSource. If the latter then tries
the "non-jta-datasource" instead. When I now switched to using pax-jdbc, it
will always be a DataSource and never an XADataSource. Perhaps that fooled
OpenJPA.

But, by specifying the openjpa.ConnectionFactory2Name (I set it to a
non-jta enabled data source) seems to do the trick.

/Bengt


2016-07-11 21:54 GMT+02:00 Charlie Mordant <cm...@gmail.com>:

> Hi Bengt,
>
> I think that is not really an OpenJPA issue, but a kind of a missbehavior.
> I heard about a JIRA ticket telling that AriesJpa2 (K4.0.5 version) isn't
> really using the persistence provider's classloader: it may be related...
> The other point could be a start order behavior, but I also saw that
> pax-jdbc karaf feature is now using karaf requirement and capabilities so
> it could be also fixed ;).
>
> So let's wait and see K4.0.6 version!
>
> Regards,
>
> 2016-07-11 10:23 GMT+02:00 Bengt Rodehav <be...@rodehav.com>:
>
> > Did you ever get an answer to this? I have the same problem using OpenJPA
> > in Karaf with Aries JPA.
> >
> > When creating the Derby database, the JTA datasource is being used
> although
> > I have also provided a non-JTA datasource for this purpose. To me it
> sounds
> > like an OpenJPA problem.
> >
> > /Bengt
> >
> > 2014-12-02 22:30 GMT+01:00 Charlie Mordant <cm...@gmail.com>:
> >
> > > Hello again Rick,
> > >
> > > On my side, the bug seems to be a pax-jdbc-pool-aries one, I switched
> to
> > > commons-dbcp2 and it seems to work well (7 CI builds without any
> error).
> > >
> > > Here's my persistence.xml if it can help on the Openjpa side:
> > >
> > > <persistence-unit name="${project.artifactId}Pu"
> transaction-type="JTA">
> > >
> > >
> > >
> >
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> > >
> > >  <!-- TODO exported by database module -->
> > >
> > >  <jta-data-source>osgi:service/javax.sql.DataSource/(
> > > osgi.jndi.service.name
> > > =${project.parent.artifactId}.database)</jta-data-source>
> > >
> > >  <non-jta-data-source>osgi:service/javax.sql.DataSource/(
> > > osgi.jndi.service.name=${project.parent.artifactId}.database)</
> > > non-jta-data-source>
> > >
> > >  <class>net.osgiliath.hello.model.jpa.model.AbstractEntity</class>
> > >
> > >  <class>net.osgiliath.hello.model.jpa.model.HelloEntity</class>
> > >
> > >  <exclude-unlisted-classes>true</exclude-unlisted-classes>
> > >
> > >  <validation-mode>NONE</validation-mode>
> > >
> > >  <properties>
> > >
> > >  <property name="openjpa.Log" value="slf4j"/>
> > >
> > >  <property name="openjpa.jdbc.SynchronizeMappings" value=
> > > "buildSchema(ForeignKeys=true,SchemaAction=refresh)"/>
> > >
> > >  <property name="openjpa.jdbc.DBDictionary" value="derby"/>
> > >
> > >  <property name="openjpa.DataCache" value="true"/>
> > >
> > >  <property name="openjpa.RemoteCommitProvider" value="sjvm"/>
> > >
> > >  </properties>
> > >
> > > </persistence-unit>
> > >
> > >
> > > Best regards,
> > >
> > >
> > > Charlie
> > >
> > > 2014-12-02 18:48 GMT+01:00 Rick Curtis <cu...@gmail.com>:
> > >
> > > > Will you also post the contents of your persistence.xml?
> > > >
> > > > Thanks,
> > > > Rick
> > > >
> > > > On Tue, Dec 2, 2014 at 10:33 AM, Charlie Mordant <
> cmordant1@gmail.com>
> > > > wrote:
> > > >
> > > > > Hi Rick,
> > > > >
> > > > > Here's the full Trace, notice that sometimes, connection null
> > arguments
> > > > > error is not here, I'll try (not really voluntarily) to have one in
> > the
> > > > > next days.
> > > > >
> > > > >
> > > > >
> > > > > 2014-12-02 10:14:00,227 | ERROR | tenerContainer-1 | ServiceRecipe
> > > > >                | 15 - org.apache.aries.blueprint.core - 1.4.1 |
> Error
> > > > > retrieving service from ServiceRecipe[name='.component-1']
> > > > > org.osgi.service.blueprint.container.ComponentDefinitionException:
> > > > > Error when instantiating bean helloObjectRepository of class
> > > > >
> > net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:333)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         at
> > > > > java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_71]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:284)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:251)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:354)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:507)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)[org.apache.felix.framework-4.2.1.jar:]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)[org.apache.felix.framework-4.2.1.jar:]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:320)[org.apache.felix.framework-4.2.1.jar:]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.felix.framework.Felix.getService(Felix.java:3568)[org.apache.felix.framework-4.2.1.jar:]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)[org.apache.felix.framework-4.2.1.jar:]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.getServiceSecurely(AbstractServiceReferenceRecipe.java:238)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe.getService(ReferenceRecipe.java:245)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe.access$000(ReferenceRecipe.java:55)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe$ServiceDispatcher.call(ReferenceRecipe.java:298)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         at Proxyf1b53549_cd1d_4178_b560_3b6ec0a6c6ac.save(Unknown
> > > > > Source)[:]
> > > > >         at
> > > > >
> > > >
> > >
> >
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.persistHello(HelloServiceJMS.java:106)[239:net.osgiliath.hello.business.impl.blueprint:0.1.1.SNAPSHOT]
> > > > >         at
> > > > >
> > > >
> > >
> >
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.onMessage(HelloServiceJMS.java:159)[239:net.osgiliath.hello.business.impl.blueprint:0.1.1.SNAPSHOT]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > > > >         at java.lang.Thread.run(Thread.java:745)[:1.7.0_71]
> > > > > Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general error>
> > > > > org.apache.openjpa.persistence.PersistenceException: There were
> > errors
> > > > > initializing your configuration: <openjpa-2.3.0-r422266:1540826
> fatal
> > > > > user error> org.apache.openjpa.util.UserException: A connection
> could
> > > > > not be obtained for driver class "null" and URL "null".  You may
> have
> > > > > specified an invalid URL.
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:255)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:241)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory2(JDBCConfigurationImpl.java:807)
> > > > >         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:606)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:310)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1670)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:651)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getMetamodel(JTAEntityManager.java:409)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:60)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.data.jpa.repository.support.SimpleJpaRepository.<init>(SimpleJpaRepository.java:96)
> > > > >         at
> > > > >
> > > >
> > >
> >
> net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository.<init>(HelloObjectJpaRepository.java:59)
> > > > >         at
> > > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> > > > > Method)
> > > > >         at
> > > > >
> > > >
> > >
> >
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
> > > > >         at
> > > > >
> > > >
> > >
> >
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> > > > >         at
> > > > java.lang.reflect.Constructor.newInstance(Constructor.java:526)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.utils.ReflectionUtils.newInstance(ReflectionUtils.java:329)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.newInstance(BeanRecipe.java:962)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:331)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
> > > > >         at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
> > > > >         at
> > > > >
> > >
> org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:284)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:251)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:354)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:507)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:320)
> > > > >         at
> > org.apache.felix.framework.Felix.getService(Felix.java:3568)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.getServiceSecurely(AbstractServiceReferenceRecipe.java:238)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe.getService(ReferenceRecipe.java:245)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe.access$000(ReferenceRecipe.java:55)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe$ServiceDispatcher.call(ReferenceRecipe.java:298)
> > > > >         at Proxyf1b53549_cd1d_4178_b560_3b6ec0a6c6ac.save(Unknown
> > > Source)
> > > > >         at
> > > > >
> > > >
> > >
> >
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.persistHello(HelloServiceJMS.java:106)
> > > > >         at
> > > > >
> > > >
> > >
> >
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.onMessage(HelloServiceJMS.java:159)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)
> > > > >         at java.lang.Thread.run(Thread.java:745)
> > > > > Caused by: java.sql.SQLException: Commande setAutoCommit(true) non
> > > > > valide au cours de la transaction globale.
> > > > >         at
> > > > >
> > >
> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown
> > > > > Source)
> > > > >         at
> > > > org.apache.derby.client.am.SqlException.getSQLException(Unknown
> > > > > Source)
> > > > >         at
> > org.apache.derby.client.am.Connection.setAutoCommit(Unknown
> > > > > Source)
> > > > >         at
> > > > > org.apache.derby.client.am.LogicalConnection.setAutoCommit(Unknown
> > > > Source)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.tranql.connector.jdbc.ManagedXAConnection.localTransactionCommit(ManagedXAConnection.java:104)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.commit(AbstractManagedConnection.java:199)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.tranql.connector.jdbc.ConnectionHandle.commit(ConnectionHandle.java:125)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.tranql.connector.jdbc.ManagedJDBCConnection.localTransactionCommit(ManagedJDBCConnection.java:92)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.commit(AbstractManagedConnection.java:199)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.tranql.connector.jdbc.ConnectionHandle.setAutoCommit(ConnectionHandle.java:168)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.lib.jdbc.DelegatingConnection.setAutoCommit(DelegatingConnection.java:167)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.lib.jdbc.DelegatingConnection.setAutoCommit(DelegatingConnection.java:167)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.setAutoCommit(ConfiguringConnectionDecorator.java:117)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.<init>(ConfiguringConnectionDecorator.java:111)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator.decorate(ConfiguringConnectionDecorator.java:93)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.lib.jdbc.DecoratingDataSource.decorate(DecoratingDataSource.java:99)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:94)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:236)
> > > > >         ... 58 more
> > > > > Caused by: org.apache.derby.client.am.SqlException: Commande
> > > > > setAutoCommit(true) non valide au cours de la transaction globale.
> > > > >         ... 74 more
> > > > >
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:218)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[225:org.apache.aries.jpa.container.context:1.0.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[225:org.apache.aries.jpa.container.context:1.0.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getMetamodel(JTAEntityManager.java:409)[225:org.apache.aries.jpa.container.context:1.0.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:60)
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.springframework.data.jpa.repository.support.SimpleJpaRepository.<init>(SimpleJpaRepository.java:96)
> > > > >         at
> > > > >
> > > >
> > >
> >
> net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository.<init>(HelloObjectJpaRepository.java:59)
> > > > >         at
> > > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> > > > > Method)[:1.7.0_71]
> > > > >         at
> > > > >
> > > >
> > >
> >
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)[:1.7.0_71]
> > > > >         at
> > > > >
> > > >
> > >
> >
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.7.0_71]
> > > > >         at
> > > > >
> > > >
> > >
> >
> java.lang.reflect.Constructor.newInstance(Constructor.java:526)[:1.7.0_71]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.utils.ReflectionUtils.newInstance(ReflectionUtils.java:329)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.newInstance(BeanRecipe.java:962)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         at
> > > > >
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:331)[15:org.apache.aries.blueprint.core:1.4.1]
> > > > >         ... 32 more
> > > > >
> > > > > Best regards,
> > > > >
> > > > > Charlie
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > 2014-12-02 15:23 GMT+01:00 Rick Curtis <cu...@gmail.com>:
> > > > >
> > > > > > Charlie -
> > > > > >
> > > > > > Sorry I meant to reply to this thread while I was out on
> vacation.
> > > Can
> > > > I
> > > > > > have you post the entire stacktrace for the problem you're
> running
> > > > into?
> > > > > > This problem sounds familiar, but I can't recall the details.
> > > > > >
> > > > > > Thanks,
> > > > > > Rick
> > > > > >
> > > > > > On Tue, Dec 2, 2014 at 3:09 AM, Charlie Mordant <
> > cmordant1@gmail.com
> > > >
> > > > > > wrote:
> > > > > >
> > > > > > > Hi Kevin,
> > > > > > >
> > > > > > > Thank you for the idea, I'll do so :).
> > > > > > >
> > > > > > > Best regards,
> > > > > > >
> > > > > > > Charlie
> > > > > > >
> > > > > > > 2014-12-01 23:31 GMT+01:00 Kevin Sutter <kw...@gmail.com>:
> > > > > > >
> > > > > > > > Hi Charlie,
> > > > > > > > Most of my experience is in the Java EE space, not the
> > OSGi/Aries
> > > > > > > > environment.  Since WebSphere is using both Aries and
> OpenJPA,
> > > and
> > > > > > > > WebSphere supports both Java EE and OSGi programming models,
> > you
> > > > > should
> > > > > > > be
> > > > > > > > able to get this combination to work.  I'm just not sure
> what,
> > if
> > > > > any,
> > > > > > > > additional magic WebSphere had to include...  Have you been
> > > posting
> > > > > on
> > > > > > > the
> > > > > > > > Aries site as well?
> > > > > > > >
> > > > > > > > Good luck,
> > > > > > > > Kevin
> > > > > > > >
> > > > > > > > On Mon, Dec 1, 2014 at 3:53 PM, Charlie Mordant <
> > > > cmordant1@gmail.com
> > > > > >
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > > Hi Kevin,
> > > > > > > > >
> > > > > > > > > I removed the non-jta-datasource (referencing the same
> > > > connection)
> > > > > > > > because
> > > > > > > > > I thought it was the issue (and that was failing the same
> > way).
> > > > > > > > > Even if I add it, it also fails (randomly, sometimes it
> > > passes).
> > > > > > > > >
> > > > > > > > > I'm not sure it is really OpenJpa related, as I'm using
> > > > > Aries-JPA/Tx,
> > > > > > > > > Pax-JDBC.
> > > > > > > > > I'm currently investigating, and if you've any other
> pointers
> > > > I'll
> > > > > > sure
> > > > > > > > > try :).
> > > > > > > > >
> > > > > > > > > Thank you, and best regards,
> > > > > > > > >
> > > > > > > > > Charlie
> > > > > > > > >
> > > > > > > > > PS: if you're also interested in the case, you can also try
> > to
> > > > see
> > > > > > > > where's
> > > > > > > > > the catch compiling this:
> > > > > > > > >
> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > <
> > > > > > > > >
> https://github.com/OsgiliathEnterprise/net.osgiliath.parent>
> > > (it
> > > > > > will
> > > > > > > > > once on three times fail on the hello sample blueprint
> test).
> > > > > > > > >
> > > > > > > > > > Le 1 déc. 2014 à 22:41, Kevin Sutter <kwsutter@gmail.com
> >
> > a
> > > > > écrit
> > > > > > :
> > > > > > > > > >
> > > > > > > > > > Hi Charlie,
> > > > > > > > > > Since you are using SynchronizeMappings, you should be
> > > > providing
> > > > > an
> > > > > > > > > > alternate datasource (non-jta-data-source) in addition to
> > the
> > > > > > > > > > jta-data-source.  OpenJPA requires access to the database
> > in
> > > > > order
> > > > > > to
> > > > > > > > > > define or adjust your schemas based on your Entity
> > > definitions.
> > > > > > > > Without
> > > > > > > > > a
> > > > > > > > > > non-jta-data-source, OpenJPA will attempt to do this work
> > > > within
> > > > > > the
> > > > > > > > > global
> > > > > > > > > > transaction.  Unfortunately, the auto commit processing
> > > doesn't
> > > > > > work
> > > > > > > > well
> > > > > > > > > > within a global transaction (as you have found out).
> > > > > > > > > >
> > > > > > > > > > Hope this helps.
> > > > > > > > > >
> > > > > > > > > > Kevin
> > > > > > > > > >
> > > > > > > > > > On Sun, Nov 30, 2014 at 9:05 AM, Charlie Mordant <
> > > > > > > cmordant1@gmail.com>
> > > > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > >> Hi OpenJPA Guru's,
> > > > > > > > > >>
> > > > > > > > > >> I'm encountering an issue when openJPA participates to a
> > > > global
> > > > > > > > > >> transaction, I've got this weird error happening
> > sometimes:
> > > > > > > > > >>
> > > > > > > > > >> Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal
> general
> > > > > error>
> > > > > > > > > >> org.apache.openjpa.persistence.PersistenceException:
> > > > > > > > > >> setAutoCommit(true) invalid during global transaction.
> > > > > > > > > >>
> > > > > > > > > >>        at
> > > > > > > > > >>
> > > > > > >
> > > org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:559)
> > > > > > > > > >>
> > > > > > > > > >>        at
> > > > > > > > > >>
> > > > > > >
> > > org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
> > > > > > > > > >>
> > > > > > > > > >>
> > > > > > > > > >> My persistence.xml is as simple as it can be:
> > > > > > > > > >> [code]
> > > > > > > > > >>
> > > > > > > > > >> <persistence-unit name="${project.artifactId}Pu"
> > > > > > > > transaction-type="JTA">
> > > > > > > > > >>
> > > > > > > > > >>
> > > > > > > > > >>
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> > > > > > > > > >>
> > > > > > > > > >>
> <jta-data-source>osgi:service/javax.sql.DataSource/(&amp;(
> > > > > > > > > >> osgi.jndi.service.name
> > > > > > > > > >>
> > > =${project.parent.artifactId}.database)(aries.managed=true))</
> > > > > > > > > >> jta-data-source>
> > > > > > > > > >>
> > > > > > > > > >> <properties>
> > > > > > > > > >>
> > > > > > > > > >> <property name="openjpa.Log" value="slf4j"/>
> > > > > > > > > >>
> > > > > > > > > >> <property name="openjpa.jdbc.SynchronizeMappings" value=
> > > > > > > > > >> "buildSchema(ForeignKeys=true,SchemaAction=refresh)"/>
> > > > > > > > > >>
> > > > > > > > > >> <property name="openjpa.jdbc.DBDictionary"
> value="derby"/>
> > > > > > > > > >>
> > > > > > > > > >> </persistence-unit>
> > > > > > > > > >> [/code]
> > > > > > > > > >>
> > > > > > > > > >> Is there any property/option to set somewhere?
> > > > > > > > > >>
> > > > > > > > > >> Regards,
> > > > > > > > > >>
> > > > > > > > > >> --
> > > > > > > > > >> Charlie Mordant
> > > > > > > > > >>
> > > > > > > > > >> Full OSGI/EE stack made with Karaf:
> > > > > > > > > >>
> > https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > > > > > > > > >>
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Charlie Mordant
> > > > > > >
> > > > > > > Full OSGI/EE stack made with Karaf:
> > > > > > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > *Rick Curtis*
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Charlie Mordant
> > > > >
> > > > > Full OSGI/EE stack made with Karaf:
> > > > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > *Rick Curtis*
> > > >
> > >
> > >
> > >
> > > --
> > > Charlie Mordant
> > >
> > > Full OSGI/EE stack made with Karaf:
> > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > >
> >
>
>
>
> --
> Charlie Mordant
>
> Full OSGI/EE stack made with Karaf:
> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
>

Re: OpenJPA and auto-commit

Posted by Charlie Mordant <cm...@gmail.com>.
Hi Bengt,

I think that is not really an OpenJPA issue, but a kind of a missbehavior.
I heard about a JIRA ticket telling that AriesJpa2 (K4.0.5 version) isn't
really using the persistence provider's classloader: it may be related...
The other point could be a start order behavior, but I also saw that
pax-jdbc karaf feature is now using karaf requirement and capabilities so
it could be also fixed ;).

So let's wait and see K4.0.6 version!

Regards,

2016-07-11 10:23 GMT+02:00 Bengt Rodehav <be...@rodehav.com>:

> Did you ever get an answer to this? I have the same problem using OpenJPA
> in Karaf with Aries JPA.
>
> When creating the Derby database, the JTA datasource is being used although
> I have also provided a non-JTA datasource for this purpose. To me it sounds
> like an OpenJPA problem.
>
> /Bengt
>
> 2014-12-02 22:30 GMT+01:00 Charlie Mordant <cm...@gmail.com>:
>
> > Hello again Rick,
> >
> > On my side, the bug seems to be a pax-jdbc-pool-aries one, I switched to
> > commons-dbcp2 and it seems to work well (7 CI builds without any error).
> >
> > Here's my persistence.xml if it can help on the Openjpa side:
> >
> > <persistence-unit name="${project.artifactId}Pu" transaction-type="JTA">
> >
> >
> >
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> >
> >  <!-- TODO exported by database module -->
> >
> >  <jta-data-source>osgi:service/javax.sql.DataSource/(
> > osgi.jndi.service.name
> > =${project.parent.artifactId}.database)</jta-data-source>
> >
> >  <non-jta-data-source>osgi:service/javax.sql.DataSource/(
> > osgi.jndi.service.name=${project.parent.artifactId}.database)</
> > non-jta-data-source>
> >
> >  <class>net.osgiliath.hello.model.jpa.model.AbstractEntity</class>
> >
> >  <class>net.osgiliath.hello.model.jpa.model.HelloEntity</class>
> >
> >  <exclude-unlisted-classes>true</exclude-unlisted-classes>
> >
> >  <validation-mode>NONE</validation-mode>
> >
> >  <properties>
> >
> >  <property name="openjpa.Log" value="slf4j"/>
> >
> >  <property name="openjpa.jdbc.SynchronizeMappings" value=
> > "buildSchema(ForeignKeys=true,SchemaAction=refresh)"/>
> >
> >  <property name="openjpa.jdbc.DBDictionary" value="derby"/>
> >
> >  <property name="openjpa.DataCache" value="true"/>
> >
> >  <property name="openjpa.RemoteCommitProvider" value="sjvm"/>
> >
> >  </properties>
> >
> > </persistence-unit>
> >
> >
> > Best regards,
> >
> >
> > Charlie
> >
> > 2014-12-02 18:48 GMT+01:00 Rick Curtis <cu...@gmail.com>:
> >
> > > Will you also post the contents of your persistence.xml?
> > >
> > > Thanks,
> > > Rick
> > >
> > > On Tue, Dec 2, 2014 at 10:33 AM, Charlie Mordant <cm...@gmail.com>
> > > wrote:
> > >
> > > > Hi Rick,
> > > >
> > > > Here's the full Trace, notice that sometimes, connection null
> arguments
> > > > error is not here, I'll try (not really voluntarily) to have one in
> the
> > > > next days.
> > > >
> > > >
> > > >
> > > > 2014-12-02 10:14:00,227 | ERROR | tenerContainer-1 | ServiceRecipe
> > > >                | 15 - org.apache.aries.blueprint.core - 1.4.1 | Error
> > > > retrieving service from ServiceRecipe[name='.component-1']
> > > > org.osgi.service.blueprint.container.ComponentDefinitionException:
> > > > Error when instantiating bean helloObjectRepository of class
> > > >
> net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:333)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         at
> > > > java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_71]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:284)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:251)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:354)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:507)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         at
> > > >
> > >
> >
> org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)[org.apache.felix.framework-4.2.1.jar:]
> > > >         at
> > > >
> > >
> >
> org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)[org.apache.felix.framework-4.2.1.jar:]
> > > >         at
> > > >
> > >
> >
> org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:320)[org.apache.felix.framework-4.2.1.jar:]
> > > >         at
> > > >
> > >
> >
> org.apache.felix.framework.Felix.getService(Felix.java:3568)[org.apache.felix.framework-4.2.1.jar:]
> > > >         at
> > > >
> > >
> >
> org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)[org.apache.felix.framework-4.2.1.jar:]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.getServiceSecurely(AbstractServiceReferenceRecipe.java:238)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe.getService(ReferenceRecipe.java:245)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe.access$000(ReferenceRecipe.java:55)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe$ServiceDispatcher.call(ReferenceRecipe.java:298)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         at Proxyf1b53549_cd1d_4178_b560_3b6ec0a6c6ac.save(Unknown
> > > > Source)[:]
> > > >         at
> > > >
> > >
> >
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.persistHello(HelloServiceJMS.java:106)[239:net.osgiliath.hello.business.impl.blueprint:0.1.1.SNAPSHOT]
> > > >         at
> > > >
> > >
> >
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.onMessage(HelloServiceJMS.java:159)[239:net.osgiliath.hello.business.impl.blueprint:0.1.1.SNAPSHOT]
> > > >         at
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > > >         at
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > > >         at
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > > >         at
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > > >         at
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > > >         at
> > > >
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > > >         at
> > > >
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > > >         at
> > > >
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > > >         at java.lang.Thread.run(Thread.java:745)[:1.7.0_71]
> > > > Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general error>
> > > > org.apache.openjpa.persistence.PersistenceException: There were
> errors
> > > > initializing your configuration: <openjpa-2.3.0-r422266:1540826 fatal
> > > > user error> org.apache.openjpa.util.UserException: A connection could
> > > > not be obtained for driver class "null" and URL "null".  You may have
> > > > specified an invalid URL.
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:255)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:241)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory2(JDBCConfigurationImpl.java:807)
> > > >         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:606)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:310)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1670)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:651)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getMetamodel(JTAEntityManager.java:409)
> > > >         at
> > > >
> > >
> >
> org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:60)
> > > >         at
> > > >
> > >
> >
> org.springframework.data.jpa.repository.support.SimpleJpaRepository.<init>(SimpleJpaRepository.java:96)
> > > >         at
> > > >
> > >
> >
> net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository.<init>(HelloObjectJpaRepository.java:59)
> > > >         at
> > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> > > > Method)
> > > >         at
> > > >
> > >
> >
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
> > > >         at
> > > >
> > >
> >
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> > > >         at
> > > java.lang.reflect.Constructor.newInstance(Constructor.java:526)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.utils.ReflectionUtils.newInstance(ReflectionUtils.java:329)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.newInstance(BeanRecipe.java:962)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:331)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
> > > >         at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
> > > >         at
> > > >
> > org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:284)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:251)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:354)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:507)
> > > >         at
> > > >
> > >
> >
> org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)
> > > >         at
> > > >
> > >
> >
> org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)
> > > >         at
> > > >
> > >
> >
> org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:320)
> > > >         at
> org.apache.felix.framework.Felix.getService(Felix.java:3568)
> > > >         at
> > > >
> > >
> >
> org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.getServiceSecurely(AbstractServiceReferenceRecipe.java:238)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe.getService(ReferenceRecipe.java:245)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe.access$000(ReferenceRecipe.java:55)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe$ServiceDispatcher.call(ReferenceRecipe.java:298)
> > > >         at Proxyf1b53549_cd1d_4178_b560_3b6ec0a6c6ac.save(Unknown
> > Source)
> > > >         at
> > > >
> > >
> >
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.persistHello(HelloServiceJMS.java:106)
> > > >         at
> > > >
> > >
> >
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.onMessage(HelloServiceJMS.java:159)
> > > >         at
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)
> > > >         at
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)
> > > >         at
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)
> > > >         at
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
> > > >         at
> > > >
> > >
> >
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)
> > > >         at
> > > >
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)
> > > >         at
> > > >
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)
> > > >         at
> > > >
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)
> > > >         at java.lang.Thread.run(Thread.java:745)
> > > > Caused by: java.sql.SQLException: Commande setAutoCommit(true) non
> > > > valide au cours de la transaction globale.
> > > >         at
> > > >
> > org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown
> > > > Source)
> > > >         at
> > > org.apache.derby.client.am.SqlException.getSQLException(Unknown
> > > > Source)
> > > >         at
> org.apache.derby.client.am.Connection.setAutoCommit(Unknown
> > > > Source)
> > > >         at
> > > > org.apache.derby.client.am.LogicalConnection.setAutoCommit(Unknown
> > > Source)
> > > >         at
> > > >
> > >
> >
> org.tranql.connector.jdbc.ManagedXAConnection.localTransactionCommit(ManagedXAConnection.java:104)
> > > >         at
> > > >
> > >
> >
> org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.commit(AbstractManagedConnection.java:199)
> > > >         at
> > > >
> > >
> >
> org.tranql.connector.jdbc.ConnectionHandle.commit(ConnectionHandle.java:125)
> > > >         at
> > > >
> > >
> >
> org.tranql.connector.jdbc.ManagedJDBCConnection.localTransactionCommit(ManagedJDBCConnection.java:92)
> > > >         at
> > > >
> > >
> >
> org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.commit(AbstractManagedConnection.java:199)
> > > >         at
> > > >
> > >
> >
> org.tranql.connector.jdbc.ConnectionHandle.setAutoCommit(ConnectionHandle.java:168)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.lib.jdbc.DelegatingConnection.setAutoCommit(DelegatingConnection.java:167)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.lib.jdbc.DelegatingConnection.setAutoCommit(DelegatingConnection.java:167)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.setAutoCommit(ConfiguringConnectionDecorator.java:117)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.<init>(ConfiguringConnectionDecorator.java:111)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator.decorate(ConfiguringConnectionDecorator.java:93)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.lib.jdbc.DecoratingDataSource.decorate(DecoratingDataSource.java:99)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:94)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:236)
> > > >         ... 58 more
> > > > Caused by: org.apache.derby.client.am.SqlException: Commande
> > > > setAutoCommit(true) non valide au cours de la transaction globale.
> > > >         ... 74 more
> > > >
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:218)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
> > > >         at
> > > >
> > >
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)
> > > >         at
> > > >
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[225:org.apache.aries.jpa.container.context:1.0.1]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[225:org.apache.aries.jpa.container.context:1.0.1]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getMetamodel(JTAEntityManager.java:409)[225:org.apache.aries.jpa.container.context:1.0.1]
> > > >         at
> > > >
> > >
> >
> org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:60)
> > > >         at
> > > >
> > >
> >
> org.springframework.data.jpa.repository.support.SimpleJpaRepository.<init>(SimpleJpaRepository.java:96)
> > > >         at
> > > >
> > >
> >
> net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository.<init>(HelloObjectJpaRepository.java:59)
> > > >         at
> > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> > > > Method)[:1.7.0_71]
> > > >         at
> > > >
> > >
> >
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)[:1.7.0_71]
> > > >         at
> > > >
> > >
> >
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.7.0_71]
> > > >         at
> > > >
> > >
> >
> java.lang.reflect.Constructor.newInstance(Constructor.java:526)[:1.7.0_71]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.utils.ReflectionUtils.newInstance(ReflectionUtils.java:329)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.newInstance(BeanRecipe.java:962)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         at
> > > >
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:331)[15:org.apache.aries.blueprint.core:1.4.1]
> > > >         ... 32 more
> > > >
> > > > Best regards,
> > > >
> > > > Charlie
> > > >
> > > >
> > > >
> > > >
> > > > 2014-12-02 15:23 GMT+01:00 Rick Curtis <cu...@gmail.com>:
> > > >
> > > > > Charlie -
> > > > >
> > > > > Sorry I meant to reply to this thread while I was out on vacation.
> > Can
> > > I
> > > > > have you post the entire stacktrace for the problem you're running
> > > into?
> > > > > This problem sounds familiar, but I can't recall the details.
> > > > >
> > > > > Thanks,
> > > > > Rick
> > > > >
> > > > > On Tue, Dec 2, 2014 at 3:09 AM, Charlie Mordant <
> cmordant1@gmail.com
> > >
> > > > > wrote:
> > > > >
> > > > > > Hi Kevin,
> > > > > >
> > > > > > Thank you for the idea, I'll do so :).
> > > > > >
> > > > > > Best regards,
> > > > > >
> > > > > > Charlie
> > > > > >
> > > > > > 2014-12-01 23:31 GMT+01:00 Kevin Sutter <kw...@gmail.com>:
> > > > > >
> > > > > > > Hi Charlie,
> > > > > > > Most of my experience is in the Java EE space, not the
> OSGi/Aries
> > > > > > > environment.  Since WebSphere is using both Aries and OpenJPA,
> > and
> > > > > > > WebSphere supports both Java EE and OSGi programming models,
> you
> > > > should
> > > > > > be
> > > > > > > able to get this combination to work.  I'm just not sure what,
> if
> > > > any,
> > > > > > > additional magic WebSphere had to include...  Have you been
> > posting
> > > > on
> > > > > > the
> > > > > > > Aries site as well?
> > > > > > >
> > > > > > > Good luck,
> > > > > > > Kevin
> > > > > > >
> > > > > > > On Mon, Dec 1, 2014 at 3:53 PM, Charlie Mordant <
> > > cmordant1@gmail.com
> > > > >
> > > > > > > wrote:
> > > > > > >
> > > > > > > > Hi Kevin,
> > > > > > > >
> > > > > > > > I removed the non-jta-datasource (referencing the same
> > > connection)
> > > > > > > because
> > > > > > > > I thought it was the issue (and that was failing the same
> way).
> > > > > > > > Even if I add it, it also fails (randomly, sometimes it
> > passes).
> > > > > > > >
> > > > > > > > I'm not sure it is really OpenJpa related, as I'm using
> > > > Aries-JPA/Tx,
> > > > > > > > Pax-JDBC.
> > > > > > > > I'm currently investigating, and if you've any other pointers
> > > I'll
> > > > > sure
> > > > > > > > try :).
> > > > > > > >
> > > > > > > > Thank you, and best regards,
> > > > > > > >
> > > > > > > > Charlie
> > > > > > > >
> > > > > > > > PS: if you're also interested in the case, you can also try
> to
> > > see
> > > > > > > where's
> > > > > > > > the catch compiling this:
> > > > > > > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> <
> > > > > > > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent>
> > (it
> > > > > will
> > > > > > > > once on three times fail on the hello sample blueprint test).
> > > > > > > >
> > > > > > > > > Le 1 déc. 2014 à 22:41, Kevin Sutter <kw...@gmail.com>
> a
> > > > écrit
> > > > > :
> > > > > > > > >
> > > > > > > > > Hi Charlie,
> > > > > > > > > Since you are using SynchronizeMappings, you should be
> > > providing
> > > > an
> > > > > > > > > alternate datasource (non-jta-data-source) in addition to
> the
> > > > > > > > > jta-data-source.  OpenJPA requires access to the database
> in
> > > > order
> > > > > to
> > > > > > > > > define or adjust your schemas based on your Entity
> > definitions.
> > > > > > > Without
> > > > > > > > a
> > > > > > > > > non-jta-data-source, OpenJPA will attempt to do this work
> > > within
> > > > > the
> > > > > > > > global
> > > > > > > > > transaction.  Unfortunately, the auto commit processing
> > doesn't
> > > > > work
> > > > > > > well
> > > > > > > > > within a global transaction (as you have found out).
> > > > > > > > >
> > > > > > > > > Hope this helps.
> > > > > > > > >
> > > > > > > > > Kevin
> > > > > > > > >
> > > > > > > > > On Sun, Nov 30, 2014 at 9:05 AM, Charlie Mordant <
> > > > > > cmordant1@gmail.com>
> > > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > >> Hi OpenJPA Guru's,
> > > > > > > > >>
> > > > > > > > >> I'm encountering an issue when openJPA participates to a
> > > global
> > > > > > > > >> transaction, I've got this weird error happening
> sometimes:
> > > > > > > > >>
> > > > > > > > >> Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general
> > > > error>
> > > > > > > > >> org.apache.openjpa.persistence.PersistenceException:
> > > > > > > > >> setAutoCommit(true) invalid during global transaction.
> > > > > > > > >>
> > > > > > > > >>        at
> > > > > > > > >>
> > > > > >
> > org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:559)
> > > > > > > > >>
> > > > > > > > >>        at
> > > > > > > > >>
> > > > > >
> > org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
> > > > > > > > >>
> > > > > > > > >>
> > > > > > > > >> My persistence.xml is as simple as it can be:
> > > > > > > > >> [code]
> > > > > > > > >>
> > > > > > > > >> <persistence-unit name="${project.artifactId}Pu"
> > > > > > > transaction-type="JTA">
> > > > > > > > >>
> > > > > > > > >>
> > > > > > > > >>
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> > > > > > > > >>
> > > > > > > > >> <jta-data-source>osgi:service/javax.sql.DataSource/(&amp;(
> > > > > > > > >> osgi.jndi.service.name
> > > > > > > > >>
> > =${project.parent.artifactId}.database)(aries.managed=true))</
> > > > > > > > >> jta-data-source>
> > > > > > > > >>
> > > > > > > > >> <properties>
> > > > > > > > >>
> > > > > > > > >> <property name="openjpa.Log" value="slf4j"/>
> > > > > > > > >>
> > > > > > > > >> <property name="openjpa.jdbc.SynchronizeMappings" value=
> > > > > > > > >> "buildSchema(ForeignKeys=true,SchemaAction=refresh)"/>
> > > > > > > > >>
> > > > > > > > >> <property name="openjpa.jdbc.DBDictionary" value="derby"/>
> > > > > > > > >>
> > > > > > > > >> </persistence-unit>
> > > > > > > > >> [/code]
> > > > > > > > >>
> > > > > > > > >> Is there any property/option to set somewhere?
> > > > > > > > >>
> > > > > > > > >> Regards,
> > > > > > > > >>
> > > > > > > > >> --
> > > > > > > > >> Charlie Mordant
> > > > > > > > >>
> > > > > > > > >> Full OSGI/EE stack made with Karaf:
> > > > > > > > >>
> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > > > > > > > >>
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Charlie Mordant
> > > > > >
> > > > > > Full OSGI/EE stack made with Karaf:
> > > > > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > *Rick Curtis*
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Charlie Mordant
> > > >
> > > > Full OSGI/EE stack made with Karaf:
> > > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > > >
> > >
> > >
> > >
> > > --
> > > *Rick Curtis*
> > >
> >
> >
> >
> > --
> > Charlie Mordant
> >
> > Full OSGI/EE stack made with Karaf:
> > https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> >
>



-- 
Charlie Mordant

Full OSGI/EE stack made with Karaf:
https://github.com/OsgiliathEnterprise/net.osgiliath.parent

Re: OpenJPA and auto-commit

Posted by Bengt Rodehav <be...@rodehav.com>.
Did you ever get an answer to this? I have the same problem using OpenJPA
in Karaf with Aries JPA.

When creating the Derby database, the JTA datasource is being used although
I have also provided a non-JTA datasource for this purpose. To me it sounds
like an OpenJPA problem.

/Bengt

2014-12-02 22:30 GMT+01:00 Charlie Mordant <cm...@gmail.com>:

> Hello again Rick,
>
> On my side, the bug seems to be a pax-jdbc-pool-aries one, I switched to
> commons-dbcp2 and it seems to work well (7 CI builds without any error).
>
> Here's my persistence.xml if it can help on the Openjpa side:
>
> <persistence-unit name="${project.artifactId}Pu" transaction-type="JTA">
>
>
>  <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>
>  <!-- TODO exported by database module -->
>
>  <jta-data-source>osgi:service/javax.sql.DataSource/(
> osgi.jndi.service.name
> =${project.parent.artifactId}.database)</jta-data-source>
>
>  <non-jta-data-source>osgi:service/javax.sql.DataSource/(
> osgi.jndi.service.name=${project.parent.artifactId}.database)</
> non-jta-data-source>
>
>  <class>net.osgiliath.hello.model.jpa.model.AbstractEntity</class>
>
>  <class>net.osgiliath.hello.model.jpa.model.HelloEntity</class>
>
>  <exclude-unlisted-classes>true</exclude-unlisted-classes>
>
>  <validation-mode>NONE</validation-mode>
>
>  <properties>
>
>  <property name="openjpa.Log" value="slf4j"/>
>
>  <property name="openjpa.jdbc.SynchronizeMappings" value=
> "buildSchema(ForeignKeys=true,SchemaAction=refresh)"/>
>
>  <property name="openjpa.jdbc.DBDictionary" value="derby"/>
>
>  <property name="openjpa.DataCache" value="true"/>
>
>  <property name="openjpa.RemoteCommitProvider" value="sjvm"/>
>
>  </properties>
>
> </persistence-unit>
>
>
> Best regards,
>
>
> Charlie
>
> 2014-12-02 18:48 GMT+01:00 Rick Curtis <cu...@gmail.com>:
>
> > Will you also post the contents of your persistence.xml?
> >
> > Thanks,
> > Rick
> >
> > On Tue, Dec 2, 2014 at 10:33 AM, Charlie Mordant <cm...@gmail.com>
> > wrote:
> >
> > > Hi Rick,
> > >
> > > Here's the full Trace, notice that sometimes, connection null arguments
> > > error is not here, I'll try (not really voluntarily) to have one in the
> > > next days.
> > >
> > >
> > >
> > > 2014-12-02 10:14:00,227 | ERROR | tenerContainer-1 | ServiceRecipe
> > >                | 15 - org.apache.aries.blueprint.core - 1.4.1 | Error
> > > retrieving service from ServiceRecipe[name='.component-1']
> > > org.osgi.service.blueprint.container.ComponentDefinitionException:
> > > Error when instantiating bean helloObjectRepository of class
> > > net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:333)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         at
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         at
> > > java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_71]
> > >         at
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         at
> > >
> >
> org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         at
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:284)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:251)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:354)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:507)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         at
> > >
> >
> org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)[org.apache.felix.framework-4.2.1.jar:]
> > >         at
> > >
> >
> org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)[org.apache.felix.framework-4.2.1.jar:]
> > >         at
> > >
> >
> org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:320)[org.apache.felix.framework-4.2.1.jar:]
> > >         at
> > >
> >
> org.apache.felix.framework.Felix.getService(Felix.java:3568)[org.apache.felix.framework-4.2.1.jar:]
> > >         at
> > >
> >
> org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)[org.apache.felix.framework-4.2.1.jar:]
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.getServiceSecurely(AbstractServiceReferenceRecipe.java:238)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe.getService(ReferenceRecipe.java:245)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe.access$000(ReferenceRecipe.java:55)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe$ServiceDispatcher.call(ReferenceRecipe.java:298)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         at Proxyf1b53549_cd1d_4178_b560_3b6ec0a6c6ac.save(Unknown
> > > Source)[:]
> > >         at
> > >
> >
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.persistHello(HelloServiceJMS.java:106)[239:net.osgiliath.hello.business.impl.blueprint:0.1.1.SNAPSHOT]
> > >         at
> > >
> >
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.onMessage(HelloServiceJMS.java:159)[239:net.osgiliath.hello.business.impl.blueprint:0.1.1.SNAPSHOT]
> > >         at
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > >         at
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > >         at
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > >         at
> > >
> >
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > >         at
> > >
> >
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > >         at
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > >         at
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > >         at
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> > >         at java.lang.Thread.run(Thread.java:745)[:1.7.0_71]
> > > Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general error>
> > > org.apache.openjpa.persistence.PersistenceException: There were errors
> > > initializing your configuration: <openjpa-2.3.0-r422266:1540826 fatal
> > > user error> org.apache.openjpa.util.UserException: A connection could
> > > not be obtained for driver class "null" and URL "null".  You may have
> > > specified an invalid URL.
> > >         at
> > >
> >
> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:255)
> > >         at
> > >
> >
> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:241)
> > >         at
> > >
> >
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory2(JDBCConfigurationImpl.java:807)
> > >         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:606)
> > >         at
> > >
> >
> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:310)
> > >         at
> > >
> >
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1670)
> > >         at
> > >
> >
> org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:651)
> > >         at
> > >
> >
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203)
> > >         at
> > >
> >
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
> > >         at
> > >
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
> > >         at
> > >
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
> > >         at
> > >
> >
> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)
> > >         at
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)
> > >         at
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)
> > >         at
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getMetamodel(JTAEntityManager.java:409)
> > >         at
> > >
> >
> org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:60)
> > >         at
> > >
> >
> org.springframework.data.jpa.repository.support.SimpleJpaRepository.<init>(SimpleJpaRepository.java:96)
> > >         at
> > >
> >
> net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository.<init>(HelloObjectJpaRepository.java:59)
> > >         at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> > > Method)
> > >         at
> > >
> >
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
> > >         at
> > >
> >
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> > >         at
> > java.lang.reflect.Constructor.newInstance(Constructor.java:526)
> > >         at
> > >
> >
> org.apache.aries.blueprint.utils.ReflectionUtils.newInstance(ReflectionUtils.java:329)
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.newInstance(BeanRecipe.java:962)
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:331)
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)
> > >         at
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
> > >         at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> > >         at
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
> > >         at
> > >
> org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)
> > >         at
> > >
> >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:284)
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:251)
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:354)
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:507)
> > >         at
> > >
> >
> org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)
> > >         at
> > >
> >
> org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)
> > >         at
> > >
> >
> org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:320)
> > >         at org.apache.felix.framework.Felix.getService(Felix.java:3568)
> > >         at
> > >
> >
> org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.getServiceSecurely(AbstractServiceReferenceRecipe.java:238)
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe.getService(ReferenceRecipe.java:245)
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe.access$000(ReferenceRecipe.java:55)
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.ReferenceRecipe$ServiceDispatcher.call(ReferenceRecipe.java:298)
> > >         at Proxyf1b53549_cd1d_4178_b560_3b6ec0a6c6ac.save(Unknown
> Source)
> > >         at
> > >
> >
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.persistHello(HelloServiceJMS.java:106)
> > >         at
> > >
> >
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.onMessage(HelloServiceJMS.java:159)
> > >         at
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)
> > >         at
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)
> > >         at
> > >
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)
> > >         at
> > >
> >
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
> > >         at
> > >
> >
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)
> > >         at
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)
> > >         at
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)
> > >         at
> > >
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)
> > >         at java.lang.Thread.run(Thread.java:745)
> > > Caused by: java.sql.SQLException: Commande setAutoCommit(true) non
> > > valide au cours de la transaction globale.
> > >         at
> > >
> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown
> > > Source)
> > >         at
> > org.apache.derby.client.am.SqlException.getSQLException(Unknown
> > > Source)
> > >         at org.apache.derby.client.am.Connection.setAutoCommit(Unknown
> > > Source)
> > >         at
> > > org.apache.derby.client.am.LogicalConnection.setAutoCommit(Unknown
> > Source)
> > >         at
> > >
> >
> org.tranql.connector.jdbc.ManagedXAConnection.localTransactionCommit(ManagedXAConnection.java:104)
> > >         at
> > >
> >
> org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.commit(AbstractManagedConnection.java:199)
> > >         at
> > >
> >
> org.tranql.connector.jdbc.ConnectionHandle.commit(ConnectionHandle.java:125)
> > >         at
> > >
> >
> org.tranql.connector.jdbc.ManagedJDBCConnection.localTransactionCommit(ManagedJDBCConnection.java:92)
> > >         at
> > >
> >
> org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.commit(AbstractManagedConnection.java:199)
> > >         at
> > >
> >
> org.tranql.connector.jdbc.ConnectionHandle.setAutoCommit(ConnectionHandle.java:168)
> > >         at
> > >
> >
> org.apache.openjpa.lib.jdbc.DelegatingConnection.setAutoCommit(DelegatingConnection.java:167)
> > >         at
> > >
> >
> org.apache.openjpa.lib.jdbc.DelegatingConnection.setAutoCommit(DelegatingConnection.java:167)
> > >         at
> > >
> >
> org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.setAutoCommit(ConfiguringConnectionDecorator.java:117)
> > >         at
> > >
> >
> org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.<init>(ConfiguringConnectionDecorator.java:111)
> > >         at
> > >
> >
> org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator.decorate(ConfiguringConnectionDecorator.java:93)
> > >         at
> > >
> >
> org.apache.openjpa.lib.jdbc.DecoratingDataSource.decorate(DecoratingDataSource.java:99)
> > >         at
> > >
> >
> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:94)
> > >         at
> > >
> >
> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:236)
> > >         ... 58 more
> > > Caused by: org.apache.derby.client.am.SqlException: Commande
> > > setAutoCommit(true) non valide au cours de la transaction globale.
> > >         ... 74 more
> > >
> > >         at
> > >
> >
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:218)
> > >         at
> > >
> >
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
> > >         at
> > >
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
> > >         at
> > >
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
> > >         at
> > >
> >
> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)
> > >         at
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[225:org.apache.aries.jpa.container.context:1.0.1]
> > >         at
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[225:org.apache.aries.jpa.container.context:1.0.1]
> > >         at
> > >
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getMetamodel(JTAEntityManager.java:409)[225:org.apache.aries.jpa.container.context:1.0.1]
> > >         at
> > >
> >
> org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:60)
> > >         at
> > >
> >
> org.springframework.data.jpa.repository.support.SimpleJpaRepository.<init>(SimpleJpaRepository.java:96)
> > >         at
> > >
> >
> net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository.<init>(HelloObjectJpaRepository.java:59)
> > >         at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> > > Method)[:1.7.0_71]
> > >         at
> > >
> >
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)[:1.7.0_71]
> > >         at
> > >
> >
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.7.0_71]
> > >         at
> > >
> >
> java.lang.reflect.Constructor.newInstance(Constructor.java:526)[:1.7.0_71]
> > >         at
> > >
> >
> org.apache.aries.blueprint.utils.ReflectionUtils.newInstance(ReflectionUtils.java:329)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.newInstance(BeanRecipe.java:962)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         at
> > >
> >
> org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:331)[15:org.apache.aries.blueprint.core:1.4.1]
> > >         ... 32 more
> > >
> > > Best regards,
> > >
> > > Charlie
> > >
> > >
> > >
> > >
> > > 2014-12-02 15:23 GMT+01:00 Rick Curtis <cu...@gmail.com>:
> > >
> > > > Charlie -
> > > >
> > > > Sorry I meant to reply to this thread while I was out on vacation.
> Can
> > I
> > > > have you post the entire stacktrace for the problem you're running
> > into?
> > > > This problem sounds familiar, but I can't recall the details.
> > > >
> > > > Thanks,
> > > > Rick
> > > >
> > > > On Tue, Dec 2, 2014 at 3:09 AM, Charlie Mordant <cmordant1@gmail.com
> >
> > > > wrote:
> > > >
> > > > > Hi Kevin,
> > > > >
> > > > > Thank you for the idea, I'll do so :).
> > > > >
> > > > > Best regards,
> > > > >
> > > > > Charlie
> > > > >
> > > > > 2014-12-01 23:31 GMT+01:00 Kevin Sutter <kw...@gmail.com>:
> > > > >
> > > > > > Hi Charlie,
> > > > > > Most of my experience is in the Java EE space, not the OSGi/Aries
> > > > > > environment.  Since WebSphere is using both Aries and OpenJPA,
> and
> > > > > > WebSphere supports both Java EE and OSGi programming models, you
> > > should
> > > > > be
> > > > > > able to get this combination to work.  I'm just not sure what, if
> > > any,
> > > > > > additional magic WebSphere had to include...  Have you been
> posting
> > > on
> > > > > the
> > > > > > Aries site as well?
> > > > > >
> > > > > > Good luck,
> > > > > > Kevin
> > > > > >
> > > > > > On Mon, Dec 1, 2014 at 3:53 PM, Charlie Mordant <
> > cmordant1@gmail.com
> > > >
> > > > > > wrote:
> > > > > >
> > > > > > > Hi Kevin,
> > > > > > >
> > > > > > > I removed the non-jta-datasource (referencing the same
> > connection)
> > > > > > because
> > > > > > > I thought it was the issue (and that was failing the same way).
> > > > > > > Even if I add it, it also fails (randomly, sometimes it
> passes).
> > > > > > >
> > > > > > > I'm not sure it is really OpenJpa related, as I'm using
> > > Aries-JPA/Tx,
> > > > > > > Pax-JDBC.
> > > > > > > I'm currently investigating, and if you've any other pointers
> > I'll
> > > > sure
> > > > > > > try :).
> > > > > > >
> > > > > > > Thank you, and best regards,
> > > > > > >
> > > > > > > Charlie
> > > > > > >
> > > > > > > PS: if you're also interested in the case, you can also try to
> > see
> > > > > > where's
> > > > > > > the catch compiling this:
> > > > > > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent <
> > > > > > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent>
> (it
> > > > will
> > > > > > > once on three times fail on the hello sample blueprint test).
> > > > > > >
> > > > > > > > Le 1 déc. 2014 à 22:41, Kevin Sutter <kw...@gmail.com> a
> > > écrit
> > > > :
> > > > > > > >
> > > > > > > > Hi Charlie,
> > > > > > > > Since you are using SynchronizeMappings, you should be
> > providing
> > > an
> > > > > > > > alternate datasource (non-jta-data-source) in addition to the
> > > > > > > > jta-data-source.  OpenJPA requires access to the database in
> > > order
> > > > to
> > > > > > > > define or adjust your schemas based on your Entity
> definitions.
> > > > > > Without
> > > > > > > a
> > > > > > > > non-jta-data-source, OpenJPA will attempt to do this work
> > within
> > > > the
> > > > > > > global
> > > > > > > > transaction.  Unfortunately, the auto commit processing
> doesn't
> > > > work
> > > > > > well
> > > > > > > > within a global transaction (as you have found out).
> > > > > > > >
> > > > > > > > Hope this helps.
> > > > > > > >
> > > > > > > > Kevin
> > > > > > > >
> > > > > > > > On Sun, Nov 30, 2014 at 9:05 AM, Charlie Mordant <
> > > > > cmordant1@gmail.com>
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > >> Hi OpenJPA Guru's,
> > > > > > > >>
> > > > > > > >> I'm encountering an issue when openJPA participates to a
> > global
> > > > > > > >> transaction, I've got this weird error happening sometimes:
> > > > > > > >>
> > > > > > > >> Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general
> > > error>
> > > > > > > >> org.apache.openjpa.persistence.PersistenceException:
> > > > > > > >> setAutoCommit(true) invalid during global transaction.
> > > > > > > >>
> > > > > > > >>        at
> > > > > > > >>
> > > > >
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:559)
> > > > > > > >>
> > > > > > > >>        at
> > > > > > > >>
> > > > >
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
> > > > > > > >>
> > > > > > > >>
> > > > > > > >> My persistence.xml is as simple as it can be:
> > > > > > > >> [code]
> > > > > > > >>
> > > > > > > >> <persistence-unit name="${project.artifactId}Pu"
> > > > > > transaction-type="JTA">
> > > > > > > >>
> > > > > > > >>
> > > > > > > >>
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> > > > > > > >>
> > > > > > > >> <jta-data-source>osgi:service/javax.sql.DataSource/(&amp;(
> > > > > > > >> osgi.jndi.service.name
> > > > > > > >>
> =${project.parent.artifactId}.database)(aries.managed=true))</
> > > > > > > >> jta-data-source>
> > > > > > > >>
> > > > > > > >> <properties>
> > > > > > > >>
> > > > > > > >> <property name="openjpa.Log" value="slf4j"/>
> > > > > > > >>
> > > > > > > >> <property name="openjpa.jdbc.SynchronizeMappings" value=
> > > > > > > >> "buildSchema(ForeignKeys=true,SchemaAction=refresh)"/>
> > > > > > > >>
> > > > > > > >> <property name="openjpa.jdbc.DBDictionary" value="derby"/>
> > > > > > > >>
> > > > > > > >> </persistence-unit>
> > > > > > > >> [/code]
> > > > > > > >>
> > > > > > > >> Is there any property/option to set somewhere?
> > > > > > > >>
> > > > > > > >> Regards,
> > > > > > > >>
> > > > > > > >> --
> > > > > > > >> Charlie Mordant
> > > > > > > >>
> > > > > > > >> Full OSGI/EE stack made with Karaf:
> > > > > > > >> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > > > > > > >>
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Charlie Mordant
> > > > >
> > > > > Full OSGI/EE stack made with Karaf:
> > > > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > *Rick Curtis*
> > > >
> > >
> > >
> > >
> > > --
> > > Charlie Mordant
> > >
> > > Full OSGI/EE stack made with Karaf:
> > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > >
> >
> >
> >
> > --
> > *Rick Curtis*
> >
>
>
>
> --
> Charlie Mordant
>
> Full OSGI/EE stack made with Karaf:
> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
>

Re: OpenJPA and auto-commit

Posted by Charlie Mordant <cm...@gmail.com>.
Hello again Rick,

On my side, the bug seems to be a pax-jdbc-pool-aries one, I switched to
commons-dbcp2 and it seems to work well (7 CI builds without any error).

Here's my persistence.xml if it can help on the Openjpa side:

<persistence-unit name="${project.artifactId}Pu" transaction-type="JTA">

 <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>

 <!-- TODO exported by database module -->

 <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name
=${project.parent.artifactId}.database)</jta-data-source>

 <non-jta-data-source>osgi:service/javax.sql.DataSource/(
osgi.jndi.service.name=${project.parent.artifactId}.database)</
non-jta-data-source>

 <class>net.osgiliath.hello.model.jpa.model.AbstractEntity</class>

 <class>net.osgiliath.hello.model.jpa.model.HelloEntity</class>

 <exclude-unlisted-classes>true</exclude-unlisted-classes>

 <validation-mode>NONE</validation-mode>

 <properties>

 <property name="openjpa.Log" value="slf4j"/>

 <property name="openjpa.jdbc.SynchronizeMappings" value=
"buildSchema(ForeignKeys=true,SchemaAction=refresh)"/>

 <property name="openjpa.jdbc.DBDictionary" value="derby"/>

 <property name="openjpa.DataCache" value="true"/>

 <property name="openjpa.RemoteCommitProvider" value="sjvm"/>

 </properties>

</persistence-unit>


Best regards,


Charlie

2014-12-02 18:48 GMT+01:00 Rick Curtis <cu...@gmail.com>:

> Will you also post the contents of your persistence.xml?
>
> Thanks,
> Rick
>
> On Tue, Dec 2, 2014 at 10:33 AM, Charlie Mordant <cm...@gmail.com>
> wrote:
>
> > Hi Rick,
> >
> > Here's the full Trace, notice that sometimes, connection null arguments
> > error is not here, I'll try (not really voluntarily) to have one in the
> > next days.
> >
> >
> >
> > 2014-12-02 10:14:00,227 | ERROR | tenerContainer-1 | ServiceRecipe
> >                | 15 - org.apache.aries.blueprint.core - 1.4.1 | Error
> > retrieving service from ServiceRecipe[name='.component-1']
> > org.osgi.service.blueprint.container.ComponentDefinitionException:
> > Error when instantiating bean helloObjectRepository of class
> > net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository
> >         at
> >
> org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:333)[15:org.apache.aries.blueprint.core:1.4.1]
> >         at
> >
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)[15:org.apache.aries.blueprint.core:1.4.1]
> >         at
> >
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[15:org.apache.aries.blueprint.core:1.4.1]
> >         at
> >
> org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[15:org.apache.aries.blueprint.core:1.4.1]
> >         at
> > java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_71]
> >         at
> >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[15:org.apache.aries.blueprint.core:1.4.1]
> >         at
> >
> org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)[15:org.apache.aries.blueprint.core:1.4.1]
> >         at
> >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)[15:org.apache.aries.blueprint.core:1.4.1]
> >         at
> >
> org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:284)[15:org.apache.aries.blueprint.core:1.4.1]
> >         at
> >
> org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:251)[15:org.apache.aries.blueprint.core:1.4.1]
> >         at
> >
> org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:354)[15:org.apache.aries.blueprint.core:1.4.1]
> >         at
> >
> org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:507)[15:org.apache.aries.blueprint.core:1.4.1]
> >         at
> >
> org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)[org.apache.felix.framework-4.2.1.jar:]
> >         at
> >
> org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)[org.apache.felix.framework-4.2.1.jar:]
> >         at
> >
> org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:320)[org.apache.felix.framework-4.2.1.jar:]
> >         at
> >
> org.apache.felix.framework.Felix.getService(Felix.java:3568)[org.apache.felix.framework-4.2.1.jar:]
> >         at
> >
> org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)[org.apache.felix.framework-4.2.1.jar:]
> >         at
> >
> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.getServiceSecurely(AbstractServiceReferenceRecipe.java:238)[15:org.apache.aries.blueprint.core:1.4.1]
> >         at
> >
> org.apache.aries.blueprint.container.ReferenceRecipe.getService(ReferenceRecipe.java:245)[15:org.apache.aries.blueprint.core:1.4.1]
> >         at
> >
> org.apache.aries.blueprint.container.ReferenceRecipe.access$000(ReferenceRecipe.java:55)[15:org.apache.aries.blueprint.core:1.4.1]
> >         at
> >
> org.apache.aries.blueprint.container.ReferenceRecipe$ServiceDispatcher.call(ReferenceRecipe.java:298)[15:org.apache.aries.blueprint.core:1.4.1]
> >         at Proxyf1b53549_cd1d_4178_b560_3b6ec0a6c6ac.save(Unknown
> > Source)[:]
> >         at
> >
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.persistHello(HelloServiceJMS.java:106)[239:net.osgiliath.hello.business.impl.blueprint:0.1.1.SNAPSHOT]
> >         at
> >
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.onMessage(HelloServiceJMS.java:159)[239:net.osgiliath.hello.business.impl.blueprint:0.1.1.SNAPSHOT]
> >         at
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> >         at
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> >         at
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> >         at
> >
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> >         at
> >
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> >         at
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> >         at
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> >         at
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
> >         at java.lang.Thread.run(Thread.java:745)[:1.7.0_71]
> > Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general error>
> > org.apache.openjpa.persistence.PersistenceException: There were errors
> > initializing your configuration: <openjpa-2.3.0-r422266:1540826 fatal
> > user error> org.apache.openjpa.util.UserException: A connection could
> > not be obtained for driver class "null" and URL "null".  You may have
> > specified an invalid URL.
> >         at
> >
> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:255)
> >         at
> >
> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:241)
> >         at
> >
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory2(JDBCConfigurationImpl.java:807)
> >         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:606)
> >         at
> >
> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:310)
> >         at
> >
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1670)
> >         at
> >
> org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:651)
> >         at
> >
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203)
> >         at
> >
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
> >         at
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
> >         at
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
> >         at
> >
> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)
> >         at
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)
> >         at
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)
> >         at
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getMetamodel(JTAEntityManager.java:409)
> >         at
> >
> org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:60)
> >         at
> >
> org.springframework.data.jpa.repository.support.SimpleJpaRepository.<init>(SimpleJpaRepository.java:96)
> >         at
> >
> net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository.<init>(HelloObjectJpaRepository.java:59)
> >         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> > Method)
> >         at
> >
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
> >         at
> >
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> >         at
> java.lang.reflect.Constructor.newInstance(Constructor.java:526)
> >         at
> >
> org.apache.aries.blueprint.utils.ReflectionUtils.newInstance(ReflectionUtils.java:329)
> >         at
> >
> org.apache.aries.blueprint.container.BeanRecipe.newInstance(BeanRecipe.java:962)
> >         at
> >
> org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:331)
> >         at
> >
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)
> >         at
> >
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)
> >         at
> >
> org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
> >         at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> >         at
> >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
> >         at
> > org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)
> >         at
> >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)
> >         at
> >
> org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:284)
> >         at
> >
> org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:251)
> >         at
> >
> org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:354)
> >         at
> >
> org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:507)
> >         at
> >
> org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)
> >         at
> >
> org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)
> >         at
> >
> org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:320)
> >         at org.apache.felix.framework.Felix.getService(Felix.java:3568)
> >         at
> >
> org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)
> >         at
> >
> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.getServiceSecurely(AbstractServiceReferenceRecipe.java:238)
> >         at
> >
> org.apache.aries.blueprint.container.ReferenceRecipe.getService(ReferenceRecipe.java:245)
> >         at
> >
> org.apache.aries.blueprint.container.ReferenceRecipe.access$000(ReferenceRecipe.java:55)
> >         at
> >
> org.apache.aries.blueprint.container.ReferenceRecipe$ServiceDispatcher.call(ReferenceRecipe.java:298)
> >         at Proxyf1b53549_cd1d_4178_b560_3b6ec0a6c6ac.save(Unknown Source)
> >         at
> >
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.persistHello(HelloServiceJMS.java:106)
> >         at
> >
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.onMessage(HelloServiceJMS.java:159)
> >         at
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)
> >         at
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)
> >         at
> >
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)
> >         at
> >
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
> >         at
> >
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)
> >         at
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)
> >         at
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)
> >         at
> >
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)
> >         at java.lang.Thread.run(Thread.java:745)
> > Caused by: java.sql.SQLException: Commande setAutoCommit(true) non
> > valide au cours de la transaction globale.
> >         at
> > org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown
> > Source)
> >         at
> org.apache.derby.client.am.SqlException.getSQLException(Unknown
> > Source)
> >         at org.apache.derby.client.am.Connection.setAutoCommit(Unknown
> > Source)
> >         at
> > org.apache.derby.client.am.LogicalConnection.setAutoCommit(Unknown
> Source)
> >         at
> >
> org.tranql.connector.jdbc.ManagedXAConnection.localTransactionCommit(ManagedXAConnection.java:104)
> >         at
> >
> org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.commit(AbstractManagedConnection.java:199)
> >         at
> >
> org.tranql.connector.jdbc.ConnectionHandle.commit(ConnectionHandle.java:125)
> >         at
> >
> org.tranql.connector.jdbc.ManagedJDBCConnection.localTransactionCommit(ManagedJDBCConnection.java:92)
> >         at
> >
> org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.commit(AbstractManagedConnection.java:199)
> >         at
> >
> org.tranql.connector.jdbc.ConnectionHandle.setAutoCommit(ConnectionHandle.java:168)
> >         at
> >
> org.apache.openjpa.lib.jdbc.DelegatingConnection.setAutoCommit(DelegatingConnection.java:167)
> >         at
> >
> org.apache.openjpa.lib.jdbc.DelegatingConnection.setAutoCommit(DelegatingConnection.java:167)
> >         at
> >
> org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.setAutoCommit(ConfiguringConnectionDecorator.java:117)
> >         at
> >
> org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.<init>(ConfiguringConnectionDecorator.java:111)
> >         at
> >
> org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator.decorate(ConfiguringConnectionDecorator.java:93)
> >         at
> >
> org.apache.openjpa.lib.jdbc.DecoratingDataSource.decorate(DecoratingDataSource.java:99)
> >         at
> >
> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:94)
> >         at
> >
> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:236)
> >         ... 58 more
> > Caused by: org.apache.derby.client.am.SqlException: Commande
> > setAutoCommit(true) non valide au cours de la transaction globale.
> >         ... 74 more
> >
> >         at
> >
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:218)
> >         at
> >
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
> >         at
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
> >         at
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
> >         at
> >
> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)
> >         at
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[225:org.apache.aries.jpa.container.context:1.0.1]
> >         at
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[225:org.apache.aries.jpa.container.context:1.0.1]
> >         at
> >
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getMetamodel(JTAEntityManager.java:409)[225:org.apache.aries.jpa.container.context:1.0.1]
> >         at
> >
> org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:60)
> >         at
> >
> org.springframework.data.jpa.repository.support.SimpleJpaRepository.<init>(SimpleJpaRepository.java:96)
> >         at
> >
> net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository.<init>(HelloObjectJpaRepository.java:59)
> >         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> > Method)[:1.7.0_71]
> >         at
> >
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)[:1.7.0_71]
> >         at
> >
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.7.0_71]
> >         at
> >
> java.lang.reflect.Constructor.newInstance(Constructor.java:526)[:1.7.0_71]
> >         at
> >
> org.apache.aries.blueprint.utils.ReflectionUtils.newInstance(ReflectionUtils.java:329)[15:org.apache.aries.blueprint.core:1.4.1]
> >         at
> >
> org.apache.aries.blueprint.container.BeanRecipe.newInstance(BeanRecipe.java:962)[15:org.apache.aries.blueprint.core:1.4.1]
> >         at
> >
> org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:331)[15:org.apache.aries.blueprint.core:1.4.1]
> >         ... 32 more
> >
> > Best regards,
> >
> > Charlie
> >
> >
> >
> >
> > 2014-12-02 15:23 GMT+01:00 Rick Curtis <cu...@gmail.com>:
> >
> > > Charlie -
> > >
> > > Sorry I meant to reply to this thread while I was out on vacation. Can
> I
> > > have you post the entire stacktrace for the problem you're running
> into?
> > > This problem sounds familiar, but I can't recall the details.
> > >
> > > Thanks,
> > > Rick
> > >
> > > On Tue, Dec 2, 2014 at 3:09 AM, Charlie Mordant <cm...@gmail.com>
> > > wrote:
> > >
> > > > Hi Kevin,
> > > >
> > > > Thank you for the idea, I'll do so :).
> > > >
> > > > Best regards,
> > > >
> > > > Charlie
> > > >
> > > > 2014-12-01 23:31 GMT+01:00 Kevin Sutter <kw...@gmail.com>:
> > > >
> > > > > Hi Charlie,
> > > > > Most of my experience is in the Java EE space, not the OSGi/Aries
> > > > > environment.  Since WebSphere is using both Aries and OpenJPA, and
> > > > > WebSphere supports both Java EE and OSGi programming models, you
> > should
> > > > be
> > > > > able to get this combination to work.  I'm just not sure what, if
> > any,
> > > > > additional magic WebSphere had to include...  Have you been posting
> > on
> > > > the
> > > > > Aries site as well?
> > > > >
> > > > > Good luck,
> > > > > Kevin
> > > > >
> > > > > On Mon, Dec 1, 2014 at 3:53 PM, Charlie Mordant <
> cmordant1@gmail.com
> > >
> > > > > wrote:
> > > > >
> > > > > > Hi Kevin,
> > > > > >
> > > > > > I removed the non-jta-datasource (referencing the same
> connection)
> > > > > because
> > > > > > I thought it was the issue (and that was failing the same way).
> > > > > > Even if I add it, it also fails (randomly, sometimes it passes).
> > > > > >
> > > > > > I'm not sure it is really OpenJpa related, as I'm using
> > Aries-JPA/Tx,
> > > > > > Pax-JDBC.
> > > > > > I'm currently investigating, and if you've any other pointers
> I'll
> > > sure
> > > > > > try :).
> > > > > >
> > > > > > Thank you, and best regards,
> > > > > >
> > > > > > Charlie
> > > > > >
> > > > > > PS: if you're also interested in the case, you can also try to
> see
> > > > > where's
> > > > > > the catch compiling this:
> > > > > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent <
> > > > > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent> (it
> > > will
> > > > > > once on three times fail on the hello sample blueprint test).
> > > > > >
> > > > > > > Le 1 déc. 2014 à 22:41, Kevin Sutter <kw...@gmail.com> a
> > écrit
> > > :
> > > > > > >
> > > > > > > Hi Charlie,
> > > > > > > Since you are using SynchronizeMappings, you should be
> providing
> > an
> > > > > > > alternate datasource (non-jta-data-source) in addition to the
> > > > > > > jta-data-source.  OpenJPA requires access to the database in
> > order
> > > to
> > > > > > > define or adjust your schemas based on your Entity definitions.
> > > > > Without
> > > > > > a
> > > > > > > non-jta-data-source, OpenJPA will attempt to do this work
> within
> > > the
> > > > > > global
> > > > > > > transaction.  Unfortunately, the auto commit processing doesn't
> > > work
> > > > > well
> > > > > > > within a global transaction (as you have found out).
> > > > > > >
> > > > > > > Hope this helps.
> > > > > > >
> > > > > > > Kevin
> > > > > > >
> > > > > > > On Sun, Nov 30, 2014 at 9:05 AM, Charlie Mordant <
> > > > cmordant1@gmail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > >> Hi OpenJPA Guru's,
> > > > > > >>
> > > > > > >> I'm encountering an issue when openJPA participates to a
> global
> > > > > > >> transaction, I've got this weird error happening sometimes:
> > > > > > >>
> > > > > > >> Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general
> > error>
> > > > > > >> org.apache.openjpa.persistence.PersistenceException:
> > > > > > >> setAutoCommit(true) invalid during global transaction.
> > > > > > >>
> > > > > > >>        at
> > > > > > >>
> > > > org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:559)
> > > > > > >>
> > > > > > >>        at
> > > > > > >>
> > > > org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
> > > > > > >>
> > > > > > >>
> > > > > > >> My persistence.xml is as simple as it can be:
> > > > > > >> [code]
> > > > > > >>
> > > > > > >> <persistence-unit name="${project.artifactId}Pu"
> > > > > transaction-type="JTA">
> > > > > > >>
> > > > > > >>
> > > > > > >>
> > > > > >
> > > > >
> > > >
> > >
> >
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> > > > > > >>
> > > > > > >> <jta-data-source>osgi:service/javax.sql.DataSource/(&amp;(
> > > > > > >> osgi.jndi.service.name
> > > > > > >> =${project.parent.artifactId}.database)(aries.managed=true))</
> > > > > > >> jta-data-source>
> > > > > > >>
> > > > > > >> <properties>
> > > > > > >>
> > > > > > >> <property name="openjpa.Log" value="slf4j"/>
> > > > > > >>
> > > > > > >> <property name="openjpa.jdbc.SynchronizeMappings" value=
> > > > > > >> "buildSchema(ForeignKeys=true,SchemaAction=refresh)"/>
> > > > > > >>
> > > > > > >> <property name="openjpa.jdbc.DBDictionary" value="derby"/>
> > > > > > >>
> > > > > > >> </persistence-unit>
> > > > > > >> [/code]
> > > > > > >>
> > > > > > >> Is there any property/option to set somewhere?
> > > > > > >>
> > > > > > >> Regards,
> > > > > > >>
> > > > > > >> --
> > > > > > >> Charlie Mordant
> > > > > > >>
> > > > > > >> Full OSGI/EE stack made with Karaf:
> > > > > > >> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > > > > > >>
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Charlie Mordant
> > > >
> > > > Full OSGI/EE stack made with Karaf:
> > > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > > >
> > >
> > >
> > >
> > > --
> > > *Rick Curtis*
> > >
> >
> >
> >
> > --
> > Charlie Mordant
> >
> > Full OSGI/EE stack made with Karaf:
> > https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> >
>
>
>
> --
> *Rick Curtis*
>



-- 
Charlie Mordant

Full OSGI/EE stack made with Karaf:
https://github.com/OsgiliathEnterprise/net.osgiliath.parent

Re: OpenJPA and auto-commit

Posted by Rick Curtis <cu...@gmail.com>.
Will you also post the contents of your persistence.xml?

Thanks,
Rick

On Tue, Dec 2, 2014 at 10:33 AM, Charlie Mordant <cm...@gmail.com>
wrote:

> Hi Rick,
>
> Here's the full Trace, notice that sometimes, connection null arguments
> error is not here, I'll try (not really voluntarily) to have one in the
> next days.
>
>
>
> 2014-12-02 10:14:00,227 | ERROR | tenerContainer-1 | ServiceRecipe
>                | 15 - org.apache.aries.blueprint.core - 1.4.1 | Error
> retrieving service from ServiceRecipe[name='.component-1']
> org.osgi.service.blueprint.container.ComponentDefinitionException:
> Error when instantiating bean helloObjectRepository of class
> net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository
>         at
> org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:333)[15:org.apache.aries.blueprint.core:1.4.1]
>         at
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)[15:org.apache.aries.blueprint.core:1.4.1]
>         at
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[15:org.apache.aries.blueprint.core:1.4.1]
>         at
> org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[15:org.apache.aries.blueprint.core:1.4.1]
>         at
> java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_71]
>         at
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[15:org.apache.aries.blueprint.core:1.4.1]
>         at
> org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)[15:org.apache.aries.blueprint.core:1.4.1]
>         at
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)[15:org.apache.aries.blueprint.core:1.4.1]
>         at
> org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:284)[15:org.apache.aries.blueprint.core:1.4.1]
>         at
> org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:251)[15:org.apache.aries.blueprint.core:1.4.1]
>         at
> org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:354)[15:org.apache.aries.blueprint.core:1.4.1]
>         at
> org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:507)[15:org.apache.aries.blueprint.core:1.4.1]
>         at
> org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)[org.apache.felix.framework-4.2.1.jar:]
>         at
> org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)[org.apache.felix.framework-4.2.1.jar:]
>         at
> org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:320)[org.apache.felix.framework-4.2.1.jar:]
>         at
> org.apache.felix.framework.Felix.getService(Felix.java:3568)[org.apache.felix.framework-4.2.1.jar:]
>         at
> org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)[org.apache.felix.framework-4.2.1.jar:]
>         at
> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.getServiceSecurely(AbstractServiceReferenceRecipe.java:238)[15:org.apache.aries.blueprint.core:1.4.1]
>         at
> org.apache.aries.blueprint.container.ReferenceRecipe.getService(ReferenceRecipe.java:245)[15:org.apache.aries.blueprint.core:1.4.1]
>         at
> org.apache.aries.blueprint.container.ReferenceRecipe.access$000(ReferenceRecipe.java:55)[15:org.apache.aries.blueprint.core:1.4.1]
>         at
> org.apache.aries.blueprint.container.ReferenceRecipe$ServiceDispatcher.call(ReferenceRecipe.java:298)[15:org.apache.aries.blueprint.core:1.4.1]
>         at Proxyf1b53549_cd1d_4178_b560_3b6ec0a6c6ac.save(Unknown
> Source)[:]
>         at
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.persistHello(HelloServiceJMS.java:106)[239:net.osgiliath.hello.business.impl.blueprint:0.1.1.SNAPSHOT]
>         at
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.onMessage(HelloServiceJMS.java:159)[239:net.osgiliath.hello.business.impl.blueprint:0.1.1.SNAPSHOT]
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
>         at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
>         at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
>         at java.lang.Thread.run(Thread.java:745)[:1.7.0_71]
> Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: There were errors
> initializing your configuration: <openjpa-2.3.0-r422266:1540826 fatal
> user error> org.apache.openjpa.util.UserException: A connection could
> not be obtained for driver class "null" and URL "null".  You may have
> specified an invalid URL.
>         at
> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:255)
>         at
> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:241)
>         at
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory2(JDBCConfigurationImpl.java:807)
>         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:606)
>         at
> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:310)
>         at
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1670)
>         at
> org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:651)
>         at
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203)
>         at
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
>         at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
>         at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
>         at
> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)
>         at
> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)
>         at
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)
>         at
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getMetamodel(JTAEntityManager.java:409)
>         at
> org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:60)
>         at
> org.springframework.data.jpa.repository.support.SimpleJpaRepository.<init>(SimpleJpaRepository.java:96)
>         at
> net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository.<init>(HelloObjectJpaRepository.java:59)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>         at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
>         at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>         at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
>         at
> org.apache.aries.blueprint.utils.ReflectionUtils.newInstance(ReflectionUtils.java:329)
>         at
> org.apache.aries.blueprint.container.BeanRecipe.newInstance(BeanRecipe.java:962)
>         at
> org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:331)
>         at
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)
>         at
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)
>         at
> org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>         at
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
>         at
> org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)
>         at
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)
>         at
> org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:284)
>         at
> org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:251)
>         at
> org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:354)
>         at
> org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:507)
>         at
> org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)
>         at
> org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)
>         at
> org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:320)
>         at org.apache.felix.framework.Felix.getService(Felix.java:3568)
>         at
> org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)
>         at
> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.getServiceSecurely(AbstractServiceReferenceRecipe.java:238)
>         at
> org.apache.aries.blueprint.container.ReferenceRecipe.getService(ReferenceRecipe.java:245)
>         at
> org.apache.aries.blueprint.container.ReferenceRecipe.access$000(ReferenceRecipe.java:55)
>         at
> org.apache.aries.blueprint.container.ReferenceRecipe$ServiceDispatcher.call(ReferenceRecipe.java:298)
>         at Proxyf1b53549_cd1d_4178_b560_3b6ec0a6c6ac.save(Unknown Source)
>         at
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.persistHello(HelloServiceJMS.java:106)
>         at
> net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.onMessage(HelloServiceJMS.java:159)
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)
>         at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
>         at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)
>         at java.lang.Thread.run(Thread.java:745)
> Caused by: java.sql.SQLException: Commande setAutoCommit(true) non
> valide au cours de la transaction globale.
>         at
> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown
> Source)
>         at org.apache.derby.client.am.SqlException.getSQLException(Unknown
> Source)
>         at org.apache.derby.client.am.Connection.setAutoCommit(Unknown
> Source)
>         at
> org.apache.derby.client.am.LogicalConnection.setAutoCommit(Unknown Source)
>         at
> org.tranql.connector.jdbc.ManagedXAConnection.localTransactionCommit(ManagedXAConnection.java:104)
>         at
> org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.commit(AbstractManagedConnection.java:199)
>         at
> org.tranql.connector.jdbc.ConnectionHandle.commit(ConnectionHandle.java:125)
>         at
> org.tranql.connector.jdbc.ManagedJDBCConnection.localTransactionCommit(ManagedJDBCConnection.java:92)
>         at
> org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.commit(AbstractManagedConnection.java:199)
>         at
> org.tranql.connector.jdbc.ConnectionHandle.setAutoCommit(ConnectionHandle.java:168)
>         at
> org.apache.openjpa.lib.jdbc.DelegatingConnection.setAutoCommit(DelegatingConnection.java:167)
>         at
> org.apache.openjpa.lib.jdbc.DelegatingConnection.setAutoCommit(DelegatingConnection.java:167)
>         at
> org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.setAutoCommit(ConfiguringConnectionDecorator.java:117)
>         at
> org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.<init>(ConfiguringConnectionDecorator.java:111)
>         at
> org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator.decorate(ConfiguringConnectionDecorator.java:93)
>         at
> org.apache.openjpa.lib.jdbc.DecoratingDataSource.decorate(DecoratingDataSource.java:99)
>         at
> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:94)
>         at
> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:236)
>         ... 58 more
> Caused by: org.apache.derby.client.am.SqlException: Commande
> setAutoCommit(true) non valide au cours de la transaction globale.
>         ... 74 more
>
>         at
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:218)
>         at
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
>         at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
>         at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
>         at
> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)
>         at
> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[225:org.apache.aries.jpa.container.context:1.0.1]
>         at
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[225:org.apache.aries.jpa.container.context:1.0.1]
>         at
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getMetamodel(JTAEntityManager.java:409)[225:org.apache.aries.jpa.container.context:1.0.1]
>         at
> org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:60)
>         at
> org.springframework.data.jpa.repository.support.SimpleJpaRepository.<init>(SimpleJpaRepository.java:96)
>         at
> net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository.<init>(HelloObjectJpaRepository.java:59)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)[:1.7.0_71]
>         at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)[:1.7.0_71]
>         at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.7.0_71]
>         at
> java.lang.reflect.Constructor.newInstance(Constructor.java:526)[:1.7.0_71]
>         at
> org.apache.aries.blueprint.utils.ReflectionUtils.newInstance(ReflectionUtils.java:329)[15:org.apache.aries.blueprint.core:1.4.1]
>         at
> org.apache.aries.blueprint.container.BeanRecipe.newInstance(BeanRecipe.java:962)[15:org.apache.aries.blueprint.core:1.4.1]
>         at
> org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:331)[15:org.apache.aries.blueprint.core:1.4.1]
>         ... 32 more
>
> Best regards,
>
> Charlie
>
>
>
>
> 2014-12-02 15:23 GMT+01:00 Rick Curtis <cu...@gmail.com>:
>
> > Charlie -
> >
> > Sorry I meant to reply to this thread while I was out on vacation. Can I
> > have you post the entire stacktrace for the problem you're running into?
> > This problem sounds familiar, but I can't recall the details.
> >
> > Thanks,
> > Rick
> >
> > On Tue, Dec 2, 2014 at 3:09 AM, Charlie Mordant <cm...@gmail.com>
> > wrote:
> >
> > > Hi Kevin,
> > >
> > > Thank you for the idea, I'll do so :).
> > >
> > > Best regards,
> > >
> > > Charlie
> > >
> > > 2014-12-01 23:31 GMT+01:00 Kevin Sutter <kw...@gmail.com>:
> > >
> > > > Hi Charlie,
> > > > Most of my experience is in the Java EE space, not the OSGi/Aries
> > > > environment.  Since WebSphere is using both Aries and OpenJPA, and
> > > > WebSphere supports both Java EE and OSGi programming models, you
> should
> > > be
> > > > able to get this combination to work.  I'm just not sure what, if
> any,
> > > > additional magic WebSphere had to include...  Have you been posting
> on
> > > the
> > > > Aries site as well?
> > > >
> > > > Good luck,
> > > > Kevin
> > > >
> > > > On Mon, Dec 1, 2014 at 3:53 PM, Charlie Mordant <cmordant1@gmail.com
> >
> > > > wrote:
> > > >
> > > > > Hi Kevin,
> > > > >
> > > > > I removed the non-jta-datasource (referencing the same connection)
> > > > because
> > > > > I thought it was the issue (and that was failing the same way).
> > > > > Even if I add it, it also fails (randomly, sometimes it passes).
> > > > >
> > > > > I'm not sure it is really OpenJpa related, as I'm using
> Aries-JPA/Tx,
> > > > > Pax-JDBC.
> > > > > I'm currently investigating, and if you've any other pointers I'll
> > sure
> > > > > try :).
> > > > >
> > > > > Thank you, and best regards,
> > > > >
> > > > > Charlie
> > > > >
> > > > > PS: if you're also interested in the case, you can also try to see
> > > > where's
> > > > > the catch compiling this:
> > > > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent <
> > > > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent> (it
> > will
> > > > > once on three times fail on the hello sample blueprint test).
> > > > >
> > > > > > Le 1 déc. 2014 à 22:41, Kevin Sutter <kw...@gmail.com> a
> écrit
> > :
> > > > > >
> > > > > > Hi Charlie,
> > > > > > Since you are using SynchronizeMappings, you should be providing
> an
> > > > > > alternate datasource (non-jta-data-source) in addition to the
> > > > > > jta-data-source.  OpenJPA requires access to the database in
> order
> > to
> > > > > > define or adjust your schemas based on your Entity definitions.
> > > > Without
> > > > > a
> > > > > > non-jta-data-source, OpenJPA will attempt to do this work within
> > the
> > > > > global
> > > > > > transaction.  Unfortunately, the auto commit processing doesn't
> > work
> > > > well
> > > > > > within a global transaction (as you have found out).
> > > > > >
> > > > > > Hope this helps.
> > > > > >
> > > > > > Kevin
> > > > > >
> > > > > > On Sun, Nov 30, 2014 at 9:05 AM, Charlie Mordant <
> > > cmordant1@gmail.com>
> > > > > > wrote:
> > > > > >
> > > > > >> Hi OpenJPA Guru's,
> > > > > >>
> > > > > >> I'm encountering an issue when openJPA participates to a global
> > > > > >> transaction, I've got this weird error happening sometimes:
> > > > > >>
> > > > > >> Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general
> error>
> > > > > >> org.apache.openjpa.persistence.PersistenceException:
> > > > > >> setAutoCommit(true) invalid during global transaction.
> > > > > >>
> > > > > >>        at
> > > > > >>
> > > org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:559)
> > > > > >>
> > > > > >>        at
> > > > > >>
> > > org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
> > > > > >>
> > > > > >>
> > > > > >> My persistence.xml is as simple as it can be:
> > > > > >> [code]
> > > > > >>
> > > > > >> <persistence-unit name="${project.artifactId}Pu"
> > > > transaction-type="JTA">
> > > > > >>
> > > > > >>
> > > > > >>
> > > > >
> > > >
> > >
> >
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> > > > > >>
> > > > > >> <jta-data-source>osgi:service/javax.sql.DataSource/(&amp;(
> > > > > >> osgi.jndi.service.name
> > > > > >> =${project.parent.artifactId}.database)(aries.managed=true))</
> > > > > >> jta-data-source>
> > > > > >>
> > > > > >> <properties>
> > > > > >>
> > > > > >> <property name="openjpa.Log" value="slf4j"/>
> > > > > >>
> > > > > >> <property name="openjpa.jdbc.SynchronizeMappings" value=
> > > > > >> "buildSchema(ForeignKeys=true,SchemaAction=refresh)"/>
> > > > > >>
> > > > > >> <property name="openjpa.jdbc.DBDictionary" value="derby"/>
> > > > > >>
> > > > > >> </persistence-unit>
> > > > > >> [/code]
> > > > > >>
> > > > > >> Is there any property/option to set somewhere?
> > > > > >>
> > > > > >> Regards,
> > > > > >>
> > > > > >> --
> > > > > >> Charlie Mordant
> > > > > >>
> > > > > >> Full OSGI/EE stack made with Karaf:
> > > > > >> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > > > > >>
> > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Charlie Mordant
> > >
> > > Full OSGI/EE stack made with Karaf:
> > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > >
> >
> >
> >
> > --
> > *Rick Curtis*
> >
>
>
>
> --
> Charlie Mordant
>
> Full OSGI/EE stack made with Karaf:
> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
>



-- 
*Rick Curtis*

Re: OpenJPA and auto-commit

Posted by Charlie Mordant <cm...@gmail.com>.
Hi Rick,

Here's the full Trace, notice that sometimes, connection null arguments
error is not here, I'll try (not really voluntarily) to have one in the
next days.



2014-12-02 10:14:00,227 | ERROR | tenerContainer-1 | ServiceRecipe
               | 15 - org.apache.aries.blueprint.core - 1.4.1 | Error
retrieving service from ServiceRecipe[name='.component-1']
org.osgi.service.blueprint.container.ComponentDefinitionException:
Error when instantiating bean helloObjectRepository of class
net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository
	at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:333)[15:org.apache.aries.blueprint.core:1.4.1]
	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)[15:org.apache.aries.blueprint.core:1.4.1]
	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[15:org.apache.aries.blueprint.core:1.4.1]
	at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[15:org.apache.aries.blueprint.core:1.4.1]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_71]
	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[15:org.apache.aries.blueprint.core:1.4.1]
	at org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)[15:org.apache.aries.blueprint.core:1.4.1]
	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)[15:org.apache.aries.blueprint.core:1.4.1]
	at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:284)[15:org.apache.aries.blueprint.core:1.4.1]
	at org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:251)[15:org.apache.aries.blueprint.core:1.4.1]
	at org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:354)[15:org.apache.aries.blueprint.core:1.4.1]
	at org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:507)[15:org.apache.aries.blueprint.core:1.4.1]
	at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)[org.apache.felix.framework-4.2.1.jar:]
	at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)[org.apache.felix.framework-4.2.1.jar:]
	at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:320)[org.apache.felix.framework-4.2.1.jar:]
	at org.apache.felix.framework.Felix.getService(Felix.java:3568)[org.apache.felix.framework-4.2.1.jar:]
	at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)[org.apache.felix.framework-4.2.1.jar:]
	at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.getServiceSecurely(AbstractServiceReferenceRecipe.java:238)[15:org.apache.aries.blueprint.core:1.4.1]
	at org.apache.aries.blueprint.container.ReferenceRecipe.getService(ReferenceRecipe.java:245)[15:org.apache.aries.blueprint.core:1.4.1]
	at org.apache.aries.blueprint.container.ReferenceRecipe.access$000(ReferenceRecipe.java:55)[15:org.apache.aries.blueprint.core:1.4.1]
	at org.apache.aries.blueprint.container.ReferenceRecipe$ServiceDispatcher.call(ReferenceRecipe.java:298)[15:org.apache.aries.blueprint.core:1.4.1]
	at Proxyf1b53549_cd1d_4178_b560_3b6ec0a6c6ac.save(Unknown Source)[:]
	at net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.persistHello(HelloServiceJMS.java:106)[239:net.osgiliath.hello.business.impl.blueprint:0.1.1.SNAPSHOT]
	at net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.onMessage(HelloServiceJMS.java:159)[239:net.osgiliath.hello.business.impl.blueprint:0.1.1.SNAPSHOT]
	at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
	at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
	at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)[167:org.apache.servicemix.bundles.spring-jms:3.2.11.RELEASE_1]
	at java.lang.Thread.run(Thread.java:745)[:1.7.0_71]
Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: There were errors
initializing your configuration: <openjpa-2.3.0-r422266:1540826 fatal
user error> org.apache.openjpa.util.UserException: A connection could
not be obtained for driver class "null" and URL "null".  You may have
specified an invalid URL.
	at org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:255)
	at org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:241)
	at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory2(JDBCConfigurationImpl.java:807)
	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:606)
	at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:310)
	at org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1670)
	at org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:651)
	at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203)
	at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
	at org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)
	at org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)
	at org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)
	at org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getMetamodel(JTAEntityManager.java:409)
	at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:60)
	at org.springframework.data.jpa.repository.support.SimpleJpaRepository.<init>(SimpleJpaRepository.java:96)
	at net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository.<init>(HelloObjectJpaRepository.java:59)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at org.apache.aries.blueprint.utils.ReflectionUtils.newInstance(ReflectionUtils.java:329)
	at org.apache.aries.blueprint.container.BeanRecipe.newInstance(BeanRecipe.java:962)
	at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:331)
	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)
	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)
	at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
	at org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)
	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)
	at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:284)
	at org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:251)
	at org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:354)
	at org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:507)
	at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)
	at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)
	at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:320)
	at org.apache.felix.framework.Felix.getService(Felix.java:3568)
	at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)
	at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.getServiceSecurely(AbstractServiceReferenceRecipe.java:238)
	at org.apache.aries.blueprint.container.ReferenceRecipe.getService(ReferenceRecipe.java:245)
	at org.apache.aries.blueprint.container.ReferenceRecipe.access$000(ReferenceRecipe.java:55)
	at org.apache.aries.blueprint.container.ReferenceRecipe$ServiceDispatcher.call(ReferenceRecipe.java:298)
	at Proxyf1b53549_cd1d_4178_b560_3b6ec0a6c6ac.save(Unknown Source)
	at net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.persistHello(HelloServiceJMS.java:106)
	at net.osgiliath.hello.business.impl.services.impl.HelloServiceJMS.onMessage(HelloServiceJMS.java:159)
	at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)
	at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)
	at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)
	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)
	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)
	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)
	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: Commande setAutoCommit(true) non
valide au cours de la transaction globale.
	at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown
Source)
	at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
	at org.apache.derby.client.am.Connection.setAutoCommit(Unknown Source)
	at org.apache.derby.client.am.LogicalConnection.setAutoCommit(Unknown Source)
	at org.tranql.connector.jdbc.ManagedXAConnection.localTransactionCommit(ManagedXAConnection.java:104)
	at org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.commit(AbstractManagedConnection.java:199)
	at org.tranql.connector.jdbc.ConnectionHandle.commit(ConnectionHandle.java:125)
	at org.tranql.connector.jdbc.ManagedJDBCConnection.localTransactionCommit(ManagedJDBCConnection.java:92)
	at org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.commit(AbstractManagedConnection.java:199)
	at org.tranql.connector.jdbc.ConnectionHandle.setAutoCommit(ConnectionHandle.java:168)
	at org.apache.openjpa.lib.jdbc.DelegatingConnection.setAutoCommit(DelegatingConnection.java:167)
	at org.apache.openjpa.lib.jdbc.DelegatingConnection.setAutoCommit(DelegatingConnection.java:167)
	at org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.setAutoCommit(ConfiguringConnectionDecorator.java:117)
	at org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.<init>(ConfiguringConnectionDecorator.java:111)
	at org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator.decorate(ConfiguringConnectionDecorator.java:93)
	at org.apache.openjpa.lib.jdbc.DecoratingDataSource.decorate(DecoratingDataSource.java:99)
	at org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:94)
	at org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:236)
	... 58 more
Caused by: org.apache.derby.client.am.SqlException: Commande
setAutoCommit(true) non valide au cours de la transaction globale.
	... 74 more

	at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:218)
	at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
	at org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)
	at org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[225:org.apache.aries.jpa.container.context:1.0.1]
	at org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[225:org.apache.aries.jpa.container.context:1.0.1]
	at org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getMetamodel(JTAEntityManager.java:409)[225:org.apache.aries.jpa.container.context:1.0.1]
	at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:60)
	at org.springframework.data.jpa.repository.support.SimpleJpaRepository.<init>(SimpleJpaRepository.java:96)
	at net.osgiliath.hello.model.jpa.repository.impl.HelloObjectJpaRepository.<init>(HelloObjectJpaRepository.java:59)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)[:1.7.0_71]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)[:1.7.0_71]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.7.0_71]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)[:1.7.0_71]
	at org.apache.aries.blueprint.utils.ReflectionUtils.newInstance(ReflectionUtils.java:329)[15:org.apache.aries.blueprint.core:1.4.1]
	at org.apache.aries.blueprint.container.BeanRecipe.newInstance(BeanRecipe.java:962)[15:org.apache.aries.blueprint.core:1.4.1]
	at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:331)[15:org.apache.aries.blueprint.core:1.4.1]
	... 32 more

Best regards,

Charlie




2014-12-02 15:23 GMT+01:00 Rick Curtis <cu...@gmail.com>:

> Charlie -
>
> Sorry I meant to reply to this thread while I was out on vacation. Can I
> have you post the entire stacktrace for the problem you're running into?
> This problem sounds familiar, but I can't recall the details.
>
> Thanks,
> Rick
>
> On Tue, Dec 2, 2014 at 3:09 AM, Charlie Mordant <cm...@gmail.com>
> wrote:
>
> > Hi Kevin,
> >
> > Thank you for the idea, I'll do so :).
> >
> > Best regards,
> >
> > Charlie
> >
> > 2014-12-01 23:31 GMT+01:00 Kevin Sutter <kw...@gmail.com>:
> >
> > > Hi Charlie,
> > > Most of my experience is in the Java EE space, not the OSGi/Aries
> > > environment.  Since WebSphere is using both Aries and OpenJPA, and
> > > WebSphere supports both Java EE and OSGi programming models, you should
> > be
> > > able to get this combination to work.  I'm just not sure what, if any,
> > > additional magic WebSphere had to include...  Have you been posting on
> > the
> > > Aries site as well?
> > >
> > > Good luck,
> > > Kevin
> > >
> > > On Mon, Dec 1, 2014 at 3:53 PM, Charlie Mordant <cm...@gmail.com>
> > > wrote:
> > >
> > > > Hi Kevin,
> > > >
> > > > I removed the non-jta-datasource (referencing the same connection)
> > > because
> > > > I thought it was the issue (and that was failing the same way).
> > > > Even if I add it, it also fails (randomly, sometimes it passes).
> > > >
> > > > I'm not sure it is really OpenJpa related, as I'm using Aries-JPA/Tx,
> > > > Pax-JDBC.
> > > > I'm currently investigating, and if you've any other pointers I'll
> sure
> > > > try :).
> > > >
> > > > Thank you, and best regards,
> > > >
> > > > Charlie
> > > >
> > > > PS: if you're also interested in the case, you can also try to see
> > > where's
> > > > the catch compiling this:
> > > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent <
> > > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent> (it
> will
> > > > once on three times fail on the hello sample blueprint test).
> > > >
> > > > > Le 1 déc. 2014 à 22:41, Kevin Sutter <kw...@gmail.com> a écrit
> :
> > > > >
> > > > > Hi Charlie,
> > > > > Since you are using SynchronizeMappings, you should be providing an
> > > > > alternate datasource (non-jta-data-source) in addition to the
> > > > > jta-data-source.  OpenJPA requires access to the database in order
> to
> > > > > define or adjust your schemas based on your Entity definitions.
> > > Without
> > > > a
> > > > > non-jta-data-source, OpenJPA will attempt to do this work within
> the
> > > > global
> > > > > transaction.  Unfortunately, the auto commit processing doesn't
> work
> > > well
> > > > > within a global transaction (as you have found out).
> > > > >
> > > > > Hope this helps.
> > > > >
> > > > > Kevin
> > > > >
> > > > > On Sun, Nov 30, 2014 at 9:05 AM, Charlie Mordant <
> > cmordant1@gmail.com>
> > > > > wrote:
> > > > >
> > > > >> Hi OpenJPA Guru's,
> > > > >>
> > > > >> I'm encountering an issue when openJPA participates to a global
> > > > >> transaction, I've got this weird error happening sometimes:
> > > > >>
> > > > >> Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general error>
> > > > >> org.apache.openjpa.persistence.PersistenceException:
> > > > >> setAutoCommit(true) invalid during global transaction.
> > > > >>
> > > > >>        at
> > > > >>
> > org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:559)
> > > > >>
> > > > >>        at
> > > > >>
> > org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
> > > > >>
> > > > >>
> > > > >> My persistence.xml is as simple as it can be:
> > > > >> [code]
> > > > >>
> > > > >> <persistence-unit name="${project.artifactId}Pu"
> > > transaction-type="JTA">
> > > > >>
> > > > >>
> > > > >>
> > > >
> > >
> >
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> > > > >>
> > > > >> <jta-data-source>osgi:service/javax.sql.DataSource/(&amp;(
> > > > >> osgi.jndi.service.name
> > > > >> =${project.parent.artifactId}.database)(aries.managed=true))</
> > > > >> jta-data-source>
> > > > >>
> > > > >> <properties>
> > > > >>
> > > > >> <property name="openjpa.Log" value="slf4j"/>
> > > > >>
> > > > >> <property name="openjpa.jdbc.SynchronizeMappings" value=
> > > > >> "buildSchema(ForeignKeys=true,SchemaAction=refresh)"/>
> > > > >>
> > > > >> <property name="openjpa.jdbc.DBDictionary" value="derby"/>
> > > > >>
> > > > >> </persistence-unit>
> > > > >> [/code]
> > > > >>
> > > > >> Is there any property/option to set somewhere?
> > > > >>
> > > > >> Regards,
> > > > >>
> > > > >> --
> > > > >> Charlie Mordant
> > > > >>
> > > > >> Full OSGI/EE stack made with Karaf:
> > > > >> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > > > >>
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > Charlie Mordant
> >
> > Full OSGI/EE stack made with Karaf:
> > https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> >
>
>
>
> --
> *Rick Curtis*
>



-- 
Charlie Mordant

Full OSGI/EE stack made with Karaf:
https://github.com/OsgiliathEnterprise/net.osgiliath.parent

Re: OpenJPA and auto-commit

Posted by Rick Curtis <cu...@gmail.com>.
Charlie -

Sorry I meant to reply to this thread while I was out on vacation. Can I
have you post the entire stacktrace for the problem you're running into?
This problem sounds familiar, but I can't recall the details.

Thanks,
Rick

On Tue, Dec 2, 2014 at 3:09 AM, Charlie Mordant <cm...@gmail.com> wrote:

> Hi Kevin,
>
> Thank you for the idea, I'll do so :).
>
> Best regards,
>
> Charlie
>
> 2014-12-01 23:31 GMT+01:00 Kevin Sutter <kw...@gmail.com>:
>
> > Hi Charlie,
> > Most of my experience is in the Java EE space, not the OSGi/Aries
> > environment.  Since WebSphere is using both Aries and OpenJPA, and
> > WebSphere supports both Java EE and OSGi programming models, you should
> be
> > able to get this combination to work.  I'm just not sure what, if any,
> > additional magic WebSphere had to include...  Have you been posting on
> the
> > Aries site as well?
> >
> > Good luck,
> > Kevin
> >
> > On Mon, Dec 1, 2014 at 3:53 PM, Charlie Mordant <cm...@gmail.com>
> > wrote:
> >
> > > Hi Kevin,
> > >
> > > I removed the non-jta-datasource (referencing the same connection)
> > because
> > > I thought it was the issue (and that was failing the same way).
> > > Even if I add it, it also fails (randomly, sometimes it passes).
> > >
> > > I'm not sure it is really OpenJpa related, as I'm using Aries-JPA/Tx,
> > > Pax-JDBC.
> > > I'm currently investigating, and if you've any other pointers I'll sure
> > > try :).
> > >
> > > Thank you, and best regards,
> > >
> > > Charlie
> > >
> > > PS: if you're also interested in the case, you can also try to see
> > where's
> > > the catch compiling this:
> > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent <
> > > https://github.com/OsgiliathEnterprise/net.osgiliath.parent> (it will
> > > once on three times fail on the hello sample blueprint test).
> > >
> > > > Le 1 déc. 2014 à 22:41, Kevin Sutter <kw...@gmail.com> a écrit :
> > > >
> > > > Hi Charlie,
> > > > Since you are using SynchronizeMappings, you should be providing an
> > > > alternate datasource (non-jta-data-source) in addition to the
> > > > jta-data-source.  OpenJPA requires access to the database in order to
> > > > define or adjust your schemas based on your Entity definitions.
> > Without
> > > a
> > > > non-jta-data-source, OpenJPA will attempt to do this work within the
> > > global
> > > > transaction.  Unfortunately, the auto commit processing doesn't work
> > well
> > > > within a global transaction (as you have found out).
> > > >
> > > > Hope this helps.
> > > >
> > > > Kevin
> > > >
> > > > On Sun, Nov 30, 2014 at 9:05 AM, Charlie Mordant <
> cmordant1@gmail.com>
> > > > wrote:
> > > >
> > > >> Hi OpenJPA Guru's,
> > > >>
> > > >> I'm encountering an issue when openJPA participates to a global
> > > >> transaction, I've got this weird error happening sometimes:
> > > >>
> > > >> Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general error>
> > > >> org.apache.openjpa.persistence.PersistenceException:
> > > >> setAutoCommit(true) invalid during global transaction.
> > > >>
> > > >>        at
> > > >>
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:559)
> > > >>
> > > >>        at
> > > >>
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
> > > >>
> > > >>
> > > >> My persistence.xml is as simple as it can be:
> > > >> [code]
> > > >>
> > > >> <persistence-unit name="${project.artifactId}Pu"
> > transaction-type="JTA">
> > > >>
> > > >>
> > > >>
> > >
> >
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> > > >>
> > > >> <jta-data-source>osgi:service/javax.sql.DataSource/(&amp;(
> > > >> osgi.jndi.service.name
> > > >> =${project.parent.artifactId}.database)(aries.managed=true))</
> > > >> jta-data-source>
> > > >>
> > > >> <properties>
> > > >>
> > > >> <property name="openjpa.Log" value="slf4j"/>
> > > >>
> > > >> <property name="openjpa.jdbc.SynchronizeMappings" value=
> > > >> "buildSchema(ForeignKeys=true,SchemaAction=refresh)"/>
> > > >>
> > > >> <property name="openjpa.jdbc.DBDictionary" value="derby"/>
> > > >>
> > > >> </persistence-unit>
> > > >> [/code]
> > > >>
> > > >> Is there any property/option to set somewhere?
> > > >>
> > > >> Regards,
> > > >>
> > > >> --
> > > >> Charlie Mordant
> > > >>
> > > >> Full OSGI/EE stack made with Karaf:
> > > >> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > > >>
> > >
> > >
> >
>
>
>
> --
> Charlie Mordant
>
> Full OSGI/EE stack made with Karaf:
> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
>



-- 
*Rick Curtis*

Re: OpenJPA and auto-commit

Posted by Charlie Mordant <cm...@gmail.com>.
Hi Kevin,

Thank you for the idea, I'll do so :).

Best regards,

Charlie

2014-12-01 23:31 GMT+01:00 Kevin Sutter <kw...@gmail.com>:

> Hi Charlie,
> Most of my experience is in the Java EE space, not the OSGi/Aries
> environment.  Since WebSphere is using both Aries and OpenJPA, and
> WebSphere supports both Java EE and OSGi programming models, you should be
> able to get this combination to work.  I'm just not sure what, if any,
> additional magic WebSphere had to include...  Have you been posting on the
> Aries site as well?
>
> Good luck,
> Kevin
>
> On Mon, Dec 1, 2014 at 3:53 PM, Charlie Mordant <cm...@gmail.com>
> wrote:
>
> > Hi Kevin,
> >
> > I removed the non-jta-datasource (referencing the same connection)
> because
> > I thought it was the issue (and that was failing the same way).
> > Even if I add it, it also fails (randomly, sometimes it passes).
> >
> > I’m not sure it is really OpenJpa related, as I’m using Aries-JPA/Tx,
> > Pax-JDBC.
> > I’m currently investigating, and if you’ve any other pointers I’ll sure
> > try :).
> >
> > Thank you, and best regards,
> >
> > Charlie
> >
> > PS: if you’re also interested in the case, you can also try to see
> where’s
> > the catch compiling this:
> > https://github.com/OsgiliathEnterprise/net.osgiliath.parent <
> > https://github.com/OsgiliathEnterprise/net.osgiliath.parent> (it will
> > once on three times fail on the hello sample blueprint test).
> >
> > > Le 1 déc. 2014 à 22:41, Kevin Sutter <kw...@gmail.com> a écrit :
> > >
> > > Hi Charlie,
> > > Since you are using SynchronizeMappings, you should be providing an
> > > alternate datasource (non-jta-data-source) in addition to the
> > > jta-data-source.  OpenJPA requires access to the database in order to
> > > define or adjust your schemas based on your Entity definitions.
> Without
> > a
> > > non-jta-data-source, OpenJPA will attempt to do this work within the
> > global
> > > transaction.  Unfortunately, the auto commit processing doesn't work
> well
> > > within a global transaction (as you have found out).
> > >
> > > Hope this helps.
> > >
> > > Kevin
> > >
> > > On Sun, Nov 30, 2014 at 9:05 AM, Charlie Mordant <cm...@gmail.com>
> > > wrote:
> > >
> > >> Hi OpenJPA Guru's,
> > >>
> > >> I'm encountering an issue when openJPA participates to a global
> > >> transaction, I've got this weird error happening sometimes:
> > >>
> > >> Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general error>
> > >> org.apache.openjpa.persistence.PersistenceException:
> > >> setAutoCommit(true) invalid during global transaction.
> > >>
> > >>        at
> > >> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:559)
> > >>
> > >>        at
> > >> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
> > >>
> > >>
> > >> My persistence.xml is as simple as it can be:
> > >> [code]
> > >>
> > >> <persistence-unit name="${project.artifactId}Pu"
> transaction-type="JTA">
> > >>
> > >>
> > >>
> >
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> > >>
> > >> <jta-data-source>osgi:service/javax.sql.DataSource/(&amp;(
> > >> osgi.jndi.service.name
> > >> =${project.parent.artifactId}.database)(aries.managed=true))</
> > >> jta-data-source>
> > >>
> > >> <properties>
> > >>
> > >> <property name="openjpa.Log" value="slf4j"/>
> > >>
> > >> <property name="openjpa.jdbc.SynchronizeMappings" value=
> > >> "buildSchema(ForeignKeys=true,SchemaAction=refresh)"/>
> > >>
> > >> <property name="openjpa.jdbc.DBDictionary" value="derby"/>
> > >>
> > >> </persistence-unit>
> > >> [/code]
> > >>
> > >> Is there any property/option to set somewhere?
> > >>
> > >> ​Regards,​
> > >>
> > >> --
> > >> Charlie Mordant
> > >>
> > >> Full OSGI/EE stack made with Karaf:
> > >> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> > >>
> >
> >
>



-- 
Charlie Mordant

Full OSGI/EE stack made with Karaf:
https://github.com/OsgiliathEnterprise/net.osgiliath.parent

Re: OpenJPA and auto-commit

Posted by Kevin Sutter <kw...@gmail.com>.
Hi Charlie,
Most of my experience is in the Java EE space, not the OSGi/Aries
environment.  Since WebSphere is using both Aries and OpenJPA, and
WebSphere supports both Java EE and OSGi programming models, you should be
able to get this combination to work.  I'm just not sure what, if any,
additional magic WebSphere had to include...  Have you been posting on the
Aries site as well?

Good luck,
Kevin

On Mon, Dec 1, 2014 at 3:53 PM, Charlie Mordant <cm...@gmail.com> wrote:

> Hi Kevin,
>
> I removed the non-jta-datasource (referencing the same connection) because
> I thought it was the issue (and that was failing the same way).
> Even if I add it, it also fails (randomly, sometimes it passes).
>
> I’m not sure it is really OpenJpa related, as I’m using Aries-JPA/Tx,
> Pax-JDBC.
> I’m currently investigating, and if you’ve any other pointers I’ll sure
> try :).
>
> Thank you, and best regards,
>
> Charlie
>
> PS: if you’re also interested in the case, you can also try to see where’s
> the catch compiling this:
> https://github.com/OsgiliathEnterprise/net.osgiliath.parent <
> https://github.com/OsgiliathEnterprise/net.osgiliath.parent> (it will
> once on three times fail on the hello sample blueprint test).
>
> > Le 1 déc. 2014 à 22:41, Kevin Sutter <kw...@gmail.com> a écrit :
> >
> > Hi Charlie,
> > Since you are using SynchronizeMappings, you should be providing an
> > alternate datasource (non-jta-data-source) in addition to the
> > jta-data-source.  OpenJPA requires access to the database in order to
> > define or adjust your schemas based on your Entity definitions.  Without
> a
> > non-jta-data-source, OpenJPA will attempt to do this work within the
> global
> > transaction.  Unfortunately, the auto commit processing doesn't work well
> > within a global transaction (as you have found out).
> >
> > Hope this helps.
> >
> > Kevin
> >
> > On Sun, Nov 30, 2014 at 9:05 AM, Charlie Mordant <cm...@gmail.com>
> > wrote:
> >
> >> Hi OpenJPA Guru's,
> >>
> >> I'm encountering an issue when openJPA participates to a global
> >> transaction, I've got this weird error happening sometimes:
> >>
> >> Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general error>
> >> org.apache.openjpa.persistence.PersistenceException:
> >> setAutoCommit(true) invalid during global transaction.
> >>
> >>        at
> >> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:559)
> >>
> >>        at
> >> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
> >>
> >>
> >> My persistence.xml is as simple as it can be:
> >> [code]
> >>
> >> <persistence-unit name="${project.artifactId}Pu" transaction-type="JTA">
> >>
> >>
> >>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> >>
> >> <jta-data-source>osgi:service/javax.sql.DataSource/(&amp;(
> >> osgi.jndi.service.name
> >> =${project.parent.artifactId}.database)(aries.managed=true))</
> >> jta-data-source>
> >>
> >> <properties>
> >>
> >> <property name="openjpa.Log" value="slf4j"/>
> >>
> >> <property name="openjpa.jdbc.SynchronizeMappings" value=
> >> "buildSchema(ForeignKeys=true,SchemaAction=refresh)"/>
> >>
> >> <property name="openjpa.jdbc.DBDictionary" value="derby"/>
> >>
> >> </persistence-unit>
> >> [/code]
> >>
> >> Is there any property/option to set somewhere?
> >>
> >> ​Regards,​
> >>
> >> --
> >> Charlie Mordant
> >>
> >> Full OSGI/EE stack made with Karaf:
> >> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
> >>
>
>

Re: OpenJPA and auto-commit

Posted by Charlie Mordant <cm...@gmail.com>.
Hi Kevin,

I removed the non-jta-datasource (referencing the same connection) because I thought it was the issue (and that was failing the same way).
Even if I add it, it also fails (randomly, sometimes it passes).

I’m not sure it is really OpenJpa related, as I’m using Aries-JPA/Tx, Pax-JDBC.
I’m currently investigating, and if you’ve any other pointers I’ll sure try :).

Thank you, and best regards,

Charlie

PS: if you’re also interested in the case, you can also try to see where’s the catch compiling this: https://github.com/OsgiliathEnterprise/net.osgiliath.parent <https://github.com/OsgiliathEnterprise/net.osgiliath.parent> (it will once on three times fail on the hello sample blueprint test).

> Le 1 déc. 2014 à 22:41, Kevin Sutter <kw...@gmail.com> a écrit :
> 
> Hi Charlie,
> Since you are using SynchronizeMappings, you should be providing an
> alternate datasource (non-jta-data-source) in addition to the
> jta-data-source.  OpenJPA requires access to the database in order to
> define or adjust your schemas based on your Entity definitions.  Without a
> non-jta-data-source, OpenJPA will attempt to do this work within the global
> transaction.  Unfortunately, the auto commit processing doesn't work well
> within a global transaction (as you have found out).
> 
> Hope this helps.
> 
> Kevin
> 
> On Sun, Nov 30, 2014 at 9:05 AM, Charlie Mordant <cm...@gmail.com>
> wrote:
> 
>> Hi OpenJPA Guru's,
>> 
>> I'm encountering an issue when openJPA participates to a global
>> transaction, I've got this weird error happening sometimes:
>> 
>> Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general error>
>> org.apache.openjpa.persistence.PersistenceException:
>> setAutoCommit(true) invalid during global transaction.
>> 
>>        at
>> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:559)
>> 
>>        at
>> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
>> 
>> 
>> My persistence.xml is as simple as it can be:
>> [code]
>> 
>> <persistence-unit name="${project.artifactId}Pu" transaction-type="JTA">
>> 
>> 
>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>> 
>> <jta-data-source>osgi:service/javax.sql.DataSource/(&amp;(
>> osgi.jndi.service.name
>> =${project.parent.artifactId}.database)(aries.managed=true))</
>> jta-data-source>
>> 
>> <properties>
>> 
>> <property name="openjpa.Log" value="slf4j"/>
>> 
>> <property name="openjpa.jdbc.SynchronizeMappings" value=
>> "buildSchema(ForeignKeys=true,SchemaAction=refresh)"/>
>> 
>> <property name="openjpa.jdbc.DBDictionary" value="derby"/>
>> 
>> </persistence-unit>
>> [/code]
>> 
>> Is there any property/option to set somewhere?
>> 
>> ​Regards,​
>> 
>> --
>> Charlie Mordant
>> 
>> Full OSGI/EE stack made with Karaf:
>> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
>>