commit/rollbackis handled with transaction status so don'tcall it yourself
Romain Manni-Bucau @rmannibucau http://www.tomitribe.com http://rmannibucau.wordpress.com https://github.com/rmannibucau 2014-10-09 18:10 GMT+02:00 joeleclems <[email protected]>: > I try to use an @Asynchronous method... not sure to use it correctly, but > result is an exception. > > My Ejb : > > @Stateless > public class MyAsyncReceiver { > > ... > > @Asynchronous > @Lock(LockType.READ) > @AccessTimeout(-1) > public void receiveMessage(int pType) { > > ... > Session.commit(); //send the exception > "javax.jms.TransactionInProgressException" > ... > } > > ... > } > > I inject ejb (annotation @EJB) in the caller, and call "receiveMessage" > method. > javax.jms.TransactionInProgressException: Cannot commit() if an XA > transaction is already in progress > at > org.apache.activemq.TransactionContext.commit(TransactionContext.java:304) > at > org.apache.activemq.ra.ManagedTransactionContext.commit(ManagedTransactionContext.java:62) > at > org.apache.activemq.ActiveMQSession.commit(ActiveMQSession.java:574) > at > org.apache.activemq.ra.ManagedSessionProxy.commit(ManagedSessionProxy.java:108) > at > org.apache.activemq.ActiveMQQueueSession.commit(ActiveMQQueueSession.java:72) > at > test_jms.receiver.MyAsyncReceiver.validateMessage(MyAsyncReceiver.java:165) > at > test_jms.receiver.MyAsyncReceiver.receiveMessage(MyAsyncReceiver.java:107) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192) > at > org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173) > at > org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181) > at > org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192) > at > org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173) > at > org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85) > at > org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:227) > at > org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:194) > at > org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:308) > at > org.apache.openejb.core.ivm.EjbObjectProxyHandler$1.call(EjbObjectProxyHandler.java:284) > at > org.apache.openejb.async.AsynchronousPool$AsynchronousCall.call(AsynchronousPool.java:111) > at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) > at java.util.concurrent.FutureTask.run(FutureTask.java:138) > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) > at java.lang.Thread.run(Thread.java:662) > > > > > -- > View this message in context: > http://tomee-openejb.979440.n4.nabble.com/Activemq-embedded-createSession-unable-to-make-it-work-tp4672172p4672197.html > Sent from the TomEE Users mailing list archive at Nabble.com.
