Re: OpenJPA and auto-commit

2016-07-12 Thread Bengt Rodehav
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_b0knoddtya...@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 :

> 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 :
>
> > 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 :
> >
> > > 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:
> > >
> > >  transaction-type="JTA">
> > >
> > >
> > >
> >
> org.apache.openjpa.persistence.PersistenceProviderImpl
> > >
> > >  
> > >
> > >  osgi:service/javax.sql.DataSource/(
> > > osgi.jndi.service.name
> > > =${project.parent.artifactId}.database)
> > >
> > >  osgi:service/javax.sql.DataSource/(
> > > osgi.jndi.service.name=${project.parent.artifactId}.database) > > non-jta-data-source>
> > >
> > >  net.osgiliath.hello.model.jpa.model.AbstractEntity
> > >
> > >  net.osgiliath.hello.model.jpa.model.HelloEntity
> > >
> > >  true
> > >
> > >  NONE
> > >
> > >  
> > >
> > >  
> > >
> > >   > > "buildSchema(ForeignKeys=true,SchemaAction=refresh)"/>
> > >
> > >  
> > >
> > >  
> > >
> > >  
> > >
> > >  
> > >
> > > 
> > >
> > >
> > > Best regards,
> > >
> > >
> > > Charlie
> > >
> > > 2014-12-02 18:48 GMT+01:00 Rick Curtis :
> > >
> > > > Will you also post the contents of your persistence.xml?
> > > >
> > > > Thanks,
> > > > Rick
> > > >
> > > > On Tue, Dec 2, 2014 at 10:33 AM, Charlie Mordant <
> cmorda...@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
> > > > >
> > > >
> > >
> >
> 

Re: OpenJPA and auto-commit

2016-07-11 Thread Charlie Mordant
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 :

> 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 :
>
> > 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:
> >
> > 
> >
> >
> >
> org.apache.openjpa.persistence.PersistenceProviderImpl
> >
> >  
> >
> >  osgi:service/javax.sql.DataSource/(
> > osgi.jndi.service.name
> > =${project.parent.artifactId}.database)
> >
> >  osgi:service/javax.sql.DataSource/(
> > osgi.jndi.service.name=${project.parent.artifactId}.database) > non-jta-data-source>
> >
> >  net.osgiliath.hello.model.jpa.model.AbstractEntity
> >
> >  net.osgiliath.hello.model.jpa.model.HelloEntity
> >
> >  true
> >
> >  NONE
> >
> >  
> >
> >  
> >
> >   > "buildSchema(ForeignKeys=true,SchemaAction=refresh)"/>
> >
> >  
> >
> >  
> >
> >  
> >
> >  
> >
> > 
> >
> >
> > Best regards,
> >
> >
> > Charlie
> >
> > 2014-12-02 18:48 GMT+01:00 Rick Curtis :
> >
> > > Will you also post the contents of your persistence.xml?
> > >
> > > Thanks,
> > > Rick
> > >
> > > On Tue, Dec 2, 2014 at 10:33 AM, Charlie Mordant 
> > > 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
> > > >
> > >
> >
> 

Re: OpenJPA and auto-commit

2014-12-02 Thread Charlie Mordant
Hi Kevin,

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

Best regards,

Charlie

2014-12-01 23:31 GMT+01:00 Kevin Sutter kwsut...@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 cmorda...@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 kwsut...@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 cmorda...@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
  
  
  
 
 providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider
  
   jta-data-sourceosgi: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

2014-12-02 Thread Rick Curtis
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 cmorda...@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 kwsut...@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 cmorda...@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 kwsut...@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 
 cmorda...@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
   
   
   
  
 
 providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider
   
jta-data-sourceosgi: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

2014-12-02 Thread Charlie Mordant
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 

Re: OpenJPA and auto-commit

2014-12-02 Thread Rick Curtis
Will you also post the contents of your persistence.xml?

Thanks,
Rick

On Tue, Dec 2, 2014 at 10:33 AM, Charlie Mordant cmorda...@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
 

Re: OpenJPA and auto-commit

2014-12-02 Thread Charlie Mordant
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

 providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider

 !-- TODO exported by database module --

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

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

 classnet.osgiliath.hello.model.jpa.model.AbstractEntity/class

 classnet.osgiliath.hello.model.jpa.model.HelloEntity/class

 exclude-unlisted-classestrue/exclude-unlisted-classes

 validation-modeNONE/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 curti...@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 cmorda...@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
 
 

Re: OpenJPA and auto-commit

2014-12-01 Thread Kevin Sutter
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 cmorda...@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


  providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider

 jta-data-sourceosgi: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

2014-12-01 Thread Charlie Mordant
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 kwsut...@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 cmorda...@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
 
 
 providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider
 
 jta-data-sourceosgi: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

2014-12-01 Thread Kevin Sutter
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 cmorda...@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 kwsut...@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 cmorda...@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
 
 
 
 providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider
 
  jta-data-sourceosgi: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
 




OpenJPA and auto-commit

2014-11-30 Thread Charlie Mordant
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

 providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider

jta-data-sourceosgi: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