TX Control support for more recent hibernate versions

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

TX Control support for more recent hibernate versions

ivoleitao
Hi !,

I'm testing transaction control service and I was able to use local transaction with hibernate 5.2.6. However with XA transactions I'm getting a rather nasty exception as depicted at the end of this post.

Also, it's clear on the documentation (http://aries.apache.org/modules/tx-control/xaJPA.html) that it was tested only in hibernate 5.1 but since version 5.2 brings so much to the table namely java 8 native it would be interesting to have it supported. Also it's the default version on karaf 4.1 on the enterprise feature (which is what I'm currently using)

I've taken a look at the code, namely at org.apache.aries.tx.control.jpa.xa.impl.XAJPAEMFLocator and this line:

providerBundle.loadClass("org.hibernate.resource.transaction.TransactionCoordinatorBuilder");

expects TransactionCoordinatorBuilder in the package org/hibernate/resource/transaction (https://docs.jboss.org/hibernate/orm/5.1/javadocs/org/hibernate/resource/transaction/TransactionCoordinatorBuilder.html).

Unfortunately in hibernate 5.2 this class is no longer located at this package :-S but on org/hibernate/resource/transaction/spi
   
(https://docs.jboss.org/hibernate/orm/5.2/javadocs/org/hibernate/resource/transaction/spi/TransactionCoordinatorBuilder.html)

Any plans to correct this issue in a future version of transaction control (0.0.3 perhaps ?). For now I have fall back to local transactions but it's important to have xa transactions for my use case.

java.lang.NoClassDefFoundError: org/hibernate/resource/transaction/TransactionCoordinatorBuilder
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at org.apache.aries.tx.control.jpa.xa.impl.XAJPAEMFLocator$1.loadClass(XAJPAEMFLocator.java:168)
at org.apache.aries.tx.control.jpa.xa.impl.XAJPAEMFLocator.setupTransactionManager(XAJPAEMFLocator.java:98)
at org.apache.aries.tx.control.jpa.xa.impl.XAJPAEMFLocator.lambda$getResourceProvider$11(XAJPAEMFLocator.java:61)
at org.apache.aries.tx.control.jpa.xa.impl.DelayedJPAEntityManagerProvider.getResource(DelayedJPAEntityManagerProvider.java:53)
at org.apache.aries.tx.control.jpa.xa.impl.DelayedJPAEntityManagerProvider.getResource(DelayedJPAEntityManagerProvider.java:29)
at com.celfocus.platform.samples.modules.todo.data.ri.AbstractDAO.prepare(AbstractDAO.java:43)
at com.celfocus.platform.samples.modules.todo.data.ri.AbstractDAO.prepare(AbstractDAO.java:51)
at com.celfocus.platform.samples.modules.todo.data.ri.db.task.TaskDAOImpl.activate(TaskDAOImpl.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.felix.scr.impl.inject.BaseMethod.invokeMethod(BaseMethod.java:224)
at org.apache.felix.scr.impl.inject.BaseMethod.access$500(BaseMethod.java:39)
at org.apache.felix.scr.impl.inject.BaseMethod$Resolved.invoke(BaseMethod.java:617)
at org.apache.felix.scr.impl.inject.BaseMethod.invoke(BaseMethod.java:501)
at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:302)
at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:294)
at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:297)
at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:108)
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:906)
at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:879)
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:823)
at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:347)
at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:247)
at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:344)
at org.apache.felix.framework.Felix.getService(Felix.java:3699)
at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:470)
at org.osgi.util.tracker.ServiceTracker.addingService(ServiceTracker.java:414)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
at org.ops4j.pax.swissbox.tracker.ServiceLookup.getService(ServiceLookup.java:195)
at org.ops4j.pax.swissbox.tracker.ServiceLookup.getService(ServiceLookup.java:136)
at org.ops4j.pax.exam.inject.internal.ServiceInjector.injectField(ServiceInjector.java:89)
at org.ops4j.pax.exam.inject.internal.ServiceInjector.injectDeclaredFields(ServiceInjector.java:69)
at org.ops4j.pax.exam.inject.internal.ServiceInjector.injectFields(ServiceInjector.java:61)
at org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.createTest(ContainerTestRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263)
at org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChildWithRetry(ContainerTestRunner.java:84)
at org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChild(ContainerTestRunner.java:75)
at org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChild(ContainerTestRunner.java:44)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.invokeViaJUnit(JUnitProbeInvoker.java:124)
at org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.findAndInvoke(JUnitProbeInvoker.java:97)
at org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.call(JUnitProbeInvoker.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.ops4j.pax.swissbox.framework.RemoteFrameworkImpl.invokeMethodOnService(RemoteFrameworkImpl.java:433)
at org.ops4j.pax.swissbox.framework.RemoteFrameworkImpl.invokeMethodOnService(RemoteFrameworkImpl.java:406)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.hibernate.resource.transaction.TransactionCoordinatorBuilder not found by org.hibernate.core [60]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1925)
at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:978)
at org.apache.aries.tx.control.jpa.xa.impl.XAJPAEMFLocator$1.loadClass(XAJPAEMFLocator.java:181)
... 83 more​
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TX Control support for more recent hibernate versions

Timothy Ward-2
Hi,

Thank you for flagging this issue - it would be great if you could raise a JIRA to track it. It shouldn’t be too hard to detect the Hibernate version and auto-select the correct implementation, although it is unpleasant that they’ve moved a public API in a point release of the software.

If you’d like to have a go at providing a patch then please feel free. It will be at least a couple of weeks before I have any time to devote to the issue I’m afraid.

Best Regards,

Tim Ward.

> On 22 Mar 2017, at 15:08, ivoleitao <[hidden email]> wrote:
>
> Hi !,
>
> I'm testing transaction control service and I was able to use local
> transaction with hibernate 5.2.6. However with XA transactions I'm getting a
> rather nasty exception as depicted at the end of this post.
>
> Also, it's clear on the documentation
> (http://aries.apache.org/modules/tx-control/xaJPA.html) that it was tested
> only in hibernate 5.1 but since version 5.2 brings so much to the table
> namely java 8 native it would be interesting to have it supported. Also it's
> the default version on karaf 4.1 on the enterprise feature (which is what
> I'm currently using)
>
> I've taken a look at the code, namely at
> org.apache.aries.tx.control.jpa.xa.impl.XAJPAEMFLocator and this line:
>
> providerBundle.loadClass("org.hibernate.resource.transaction.TransactionCoordinatorBuilder");
>
> expects TransactionCoordinatorBuilder in the package
> org/hibernate/resource/transaction
> (https://docs.jboss.org/hibernate/orm/5.1/javadocs/org/hibernate/resource/transaction/TransactionCoordinatorBuilder.html).
>
> Unfortunately in hibernate 5.2 this class is no longer located at this
> package :-S but on org/hibernate/resource/transaction/spi
>
> (https://docs.jboss.org/hibernate/orm/5.2/javadocs/org/hibernate/resource/transaction/spi/TransactionCoordinatorBuilder.html)
>
> Any plans to correct this issue in a future version of transaction control
> (0.0.3 perhaps ?). For now I have fall back to local transactions but it's
> important to have xa transactions for my use case.
>
> java.lang.NoClassDefFoundError:
> org/hibernate/resource/transaction/TransactionCoordinatorBuilder
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
> at
> org.apache.aries.tx.control.jpa.xa.impl.XAJPAEMFLocator$1.loadClass(XAJPAEMFLocator.java:168)
> at
> org.apache.aries.tx.control.jpa.xa.impl.XAJPAEMFLocator.setupTransactionManager(XAJPAEMFLocator.java:98)
> at
> org.apache.aries.tx.control.jpa.xa.impl.XAJPAEMFLocator.lambda$getResourceProvider$11(XAJPAEMFLocator.java:61)
> at
> org.apache.aries.tx.control.jpa.xa.impl.DelayedJPAEntityManagerProvider.getResource(DelayedJPAEntityManagerProvider.java:53)
> at
> org.apache.aries.tx.control.jpa.xa.impl.DelayedJPAEntityManagerProvider.getResource(DelayedJPAEntityManagerProvider.java:29)
> at
> com.celfocus.platform.samples.modules.todo.data.ri.AbstractDAO.prepare(AbstractDAO.java:43)
> at
> com.celfocus.platform.samples.modules.todo.data.ri.AbstractDAO.prepare(AbstractDAO.java:51)
> at
> com.celfocus.platform.samples.modules.todo.data.ri.db.task.TaskDAOImpl.activate(TaskDAOImpl.java:67)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at
> org.apache.felix.scr.impl.inject.BaseMethod.invokeMethod(BaseMethod.java:224)
> at
> org.apache.felix.scr.impl.inject.BaseMethod.access$500(BaseMethod.java:39)
> at
> org.apache.felix.scr.impl.inject.BaseMethod$Resolved.invoke(BaseMethod.java:617)
> at org.apache.felix.scr.impl.inject.BaseMethod.invoke(BaseMethod.java:501)
> at
> org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:302)
> at
> org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:294)
> at
> org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:297)
> at
> org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:108)
> at
> org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:906)
> at
> org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:879)
> at
> org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:823)
> at
> org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:347)
> at
> org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:247)
> at
> org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:344)
> at org.apache.felix.framework.Felix.getService(Felix.java:3699)
> at
> org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:470)
> at
> org.osgi.util.tracker.ServiceTracker.addingService(ServiceTracker.java:414)
> at
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
> at
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
> at
> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
> at
> org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
> at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
> at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
> at
> org.ops4j.pax.swissbox.tracker.ServiceLookup.getService(ServiceLookup.java:195)
> at
> org.ops4j.pax.swissbox.tracker.ServiceLookup.getService(ServiceLookup.java:136)
> at
> org.ops4j.pax.exam.inject.internal.ServiceInjector.injectField(ServiceInjector.java:89)
> at
> org.ops4j.pax.exam.inject.internal.ServiceInjector.injectDeclaredFields(ServiceInjector.java:69)
> at
> org.ops4j.pax.exam.inject.internal.ServiceInjector.injectFields(ServiceInjector.java:61)
> at
> org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.createTest(ContainerTestRunner.java:68)
> at
> org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266)
> at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> at
> org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263)
> at
> org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChildWithRetry(ContainerTestRunner.java:84)
> at
> org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChild(ContainerTestRunner.java:75)
> at
> org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChild(ContainerTestRunner.java:44)
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
> at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
> at
> org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.invokeViaJUnit(JUnitProbeInvoker.java:124)
> at
> org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.findAndInvoke(JUnitProbeInvoker.java:97)
> at
> org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.call(JUnitProbeInvoker.java:73)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at
> org.ops4j.pax.swissbox.framework.RemoteFrameworkImpl.invokeMethodOnService(RemoteFrameworkImpl.java:433)
> at
> org.ops4j.pax.swissbox.framework.RemoteFrameworkImpl.invokeMethodOnService(RemoteFrameworkImpl.java:406)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324)
> at sun.rmi.transport.Transport$1.run(Transport.java:200)
> at sun.rmi.transport.Transport$1.run(Transport.java:197)
> at java.security.AccessController.doPrivileged(Native Method)
> at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
> at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.ClassNotFoundException:
> org.hibernate.resource.transaction.TransactionCoordinatorBuilder not found
> by org.hibernate.core [60]
> at
> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)
> at
> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
> at
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1925)
> at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:978)
> at
> org.apache.aries.tx.control.jpa.xa.impl.XAJPAEMFLocator$1.loadClass(XAJPAEMFLocator.java:181)
> ... 83 more​
>
>
>
> --
> View this message in context: http://aries.15396.n3.nabble.com/TX-Control-support-for-more-recent-hibernate-versions-tp4034998.html
> Sent from the Aries - Dev mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TX Control support for more recent hibernate versions

Timothy Ward-2
I’m afraid that a couple of weeks turned out to be more like a couple of months, but I do now have something working. It was more challenging than expected due to a number of breaking SPI changes in 5.2.0, and then again in 5.2.2!

The resulting JPA resource provider should work with all known versions of Hibernate from 5.0.0 and up. There are Hibernate bugs which prevent testing with 5.2.0, but 5.2.1 works fine, as does 5.2.10.

Given this fairly important fix, and a couple of existing unreleased changes, I propose doing a 0.0.3 release of Tx Control. After the 0.0.3 release I will begin preparing the code for a 1.0.0 release as the Reference implementation of the OSGi specification chapter.

Best Regards,

Tim


> On 10 Apr 2017, at 12:10, Timothy Ward <[hidden email]> wrote:
>
> Hi,
>
> Thank you for flagging this issue - it would be great if you could raise a JIRA to track it. It shouldn’t be too hard to detect the Hibernate version and auto-select the correct implementation, although it is unpleasant that they’ve moved a public API in a point release of the software.
>
> If you’d like to have a go at providing a patch then please feel free. It will be at least a couple of weeks before I have any time to devote to the issue I’m afraid.
>
> Best Regards,
>
> Tim Ward.
>
>> On 22 Mar 2017, at 15:08, ivoleitao <[hidden email]> wrote:
>>
>> Hi !,
>>
>> I'm testing transaction control service and I was able to use local
>> transaction with hibernate 5.2.6. However with XA transactions I'm getting a
>> rather nasty exception as depicted at the end of this post.
>>
>> Also, it's clear on the documentation
>> (http://aries.apache.org/modules/tx-control/xaJPA.html) that it was tested
>> only in hibernate 5.1 but since version 5.2 brings so much to the table
>> namely java 8 native it would be interesting to have it supported. Also it's
>> the default version on karaf 4.1 on the enterprise feature (which is what
>> I'm currently using)
>>
>> I've taken a look at the code, namely at
>> org.apache.aries.tx.control.jpa.xa.impl.XAJPAEMFLocator and this line:
>>
>> providerBundle.loadClass("org.hibernate.resource.transaction.TransactionCoordinatorBuilder");
>>
>> expects TransactionCoordinatorBuilder in the package
>> org/hibernate/resource/transaction
>> (https://docs.jboss.org/hibernate/orm/5.1/javadocs/org/hibernate/resource/transaction/TransactionCoordinatorBuilder.html).
>>
>> Unfortunately in hibernate 5.2 this class is no longer located at this
>> package :-S but on org/hibernate/resource/transaction/spi
>>
>> (https://docs.jboss.org/hibernate/orm/5.2/javadocs/org/hibernate/resource/transaction/spi/TransactionCoordinatorBuilder.html)
>>
>> Any plans to correct this issue in a future version of transaction control
>> (0.0.3 perhaps ?). For now I have fall back to local transactions but it's
>> important to have xa transactions for my use case.
>>
>> java.lang.NoClassDefFoundError:
>> org/hibernate/resource/transaction/TransactionCoordinatorBuilder
>> at java.lang.ClassLoader.defineClass1(Native Method)
>> at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
>> at
>> org.apache.aries.tx.control.jpa.xa.impl.XAJPAEMFLocator$1.loadClass(XAJPAEMFLocator.java:168)
>> at
>> org.apache.aries.tx.control.jpa.xa.impl.XAJPAEMFLocator.setupTransactionManager(XAJPAEMFLocator.java:98)
>> at
>> org.apache.aries.tx.control.jpa.xa.impl.XAJPAEMFLocator.lambda$getResourceProvider$11(XAJPAEMFLocator.java:61)
>> at
>> org.apache.aries.tx.control.jpa.xa.impl.DelayedJPAEntityManagerProvider.getResource(DelayedJPAEntityManagerProvider.java:53)
>> at
>> org.apache.aries.tx.control.jpa.xa.impl.DelayedJPAEntityManagerProvider.getResource(DelayedJPAEntityManagerProvider.java:29)
>> at
>> com.celfocus.platform.samples.modules.todo.data.ri.AbstractDAO.prepare(AbstractDAO.java:43)
>> at
>> com.celfocus.platform.samples.modules.todo.data.ri.AbstractDAO.prepare(AbstractDAO.java:51)
>> at
>> com.celfocus.platform.samples.modules.todo.data.ri.db.task.TaskDAOImpl.activate(TaskDAOImpl.java:67)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.lang.reflect.Method.invoke(Method.java:498)
>> at
>> org.apache.felix.scr.impl.inject.BaseMethod.invokeMethod(BaseMethod.java:224)
>> at
>> org.apache.felix.scr.impl.inject.BaseMethod.access$500(BaseMethod.java:39)
>> at
>> org.apache.felix.scr.impl.inject.BaseMethod$Resolved.invoke(BaseMethod.java:617)
>> at org.apache.felix.scr.impl.inject.BaseMethod.invoke(BaseMethod.java:501)
>> at
>> org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:302)
>> at
>> org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:294)
>> at
>> org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:297)
>> at
>> org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:108)
>> at
>> org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:906)
>> at
>> org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:879)
>> at
>> org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:823)
>> at
>> org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:347)
>> at
>> org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:247)
>> at
>> org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:344)
>> at org.apache.felix.framework.Felix.getService(Felix.java:3699)
>> at
>> org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:470)
>> at
>> org.osgi.util.tracker.ServiceTracker.addingService(ServiceTracker.java:414)
>> at
>> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
>> at
>> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
>> at
>> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
>> at
>> org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
>> at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
>> at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
>> at
>> org.ops4j.pax.swissbox.tracker.ServiceLookup.getService(ServiceLookup.java:195)
>> at
>> org.ops4j.pax.swissbox.tracker.ServiceLookup.getService(ServiceLookup.java:136)
>> at
>> org.ops4j.pax.exam.inject.internal.ServiceInjector.injectField(ServiceInjector.java:89)
>> at
>> org.ops4j.pax.exam.inject.internal.ServiceInjector.injectDeclaredFields(ServiceInjector.java:69)
>> at
>> org.ops4j.pax.exam.inject.internal.ServiceInjector.injectFields(ServiceInjector.java:61)
>> at
>> org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.createTest(ContainerTestRunner.java:68)
>> at
>> org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266)
>> at
>> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>> at
>> org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263)
>> at
>> org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChildWithRetry(ContainerTestRunner.java:84)
>> at
>> org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChild(ContainerTestRunner.java:75)
>> at
>> org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChild(ContainerTestRunner.java:44)
>> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>> at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>> at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
>> at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
>> at
>> org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.invokeViaJUnit(JUnitProbeInvoker.java:124)
>> at
>> org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.findAndInvoke(JUnitProbeInvoker.java:97)
>> at
>> org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.call(JUnitProbeInvoker.java:73)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.lang.reflect.Method.invoke(Method.java:498)
>> at
>> org.ops4j.pax.swissbox.framework.RemoteFrameworkImpl.invokeMethodOnService(RemoteFrameworkImpl.java:433)
>> at
>> org.ops4j.pax.swissbox.framework.RemoteFrameworkImpl.invokeMethodOnService(RemoteFrameworkImpl.java:406)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.lang.reflect.Method.invoke(Method.java:498)
>> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324)
>> at sun.rmi.transport.Transport$1.run(Transport.java:200)
>> at sun.rmi.transport.Transport$1.run(Transport.java:197)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
>> at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
>> at
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
>> at
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
>> at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>> at java.lang.Thread.run(Thread.java:745)
>> Caused by: java.lang.ClassNotFoundException:
>> org.hibernate.resource.transaction.TransactionCoordinatorBuilder not found
>> by org.hibernate.core [60]
>> at
>> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)
>> at
>> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
>> at
>> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>> at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1925)
>> at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:978)
>> at
>> org.apache.aries.tx.control.jpa.xa.impl.XAJPAEMFLocator$1.loadClass(XAJPAEMFLocator.java:181)
>> ... 83 more​
>>
>>
>>
>> --
>> View this message in context: http://aries.15396.n3.nabble.com/TX-Control-support-for-more-recent-hibernate-versions-tp4034998.html
>> Sent from the Aries - Dev mailing list archive at Nabble.com.
>

Loading...