You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by almos <al...@ukr.net> on 2012/09/06 00:36:39 UTC

Re: Strange MDB invocation behavior

I have added more logging and found that container occasionally issues
following Exception when it sends JMS message.
What the problem might be? I am creating connection in @PostConstruct method
and then reusing it when posting messages (Session/Producers are created per
send operations and not shared). Posting might occur from different threads.
Should I create connection per message send operation or sharing Connection
instance is fine?

javax.jms.JMSException: The resource is allready being used in transaction
context.
	at
org.apache.activemq.ra.ManagedTransactionContext.setUseSharedTxContext(ManagedTransactionContext.java:47)
	at
org.apache.activemq.ra.ManagedSessionProxy.setUseSharedTxContext(ManagedSessionProxy.java:67)
	at
org.apache.activemq.ra.ManagedConnectionProxy.createSessionProxy(ManagedConnectionProxy.java:122)
	at
org.apache.activemq.ra.ManagedConnectionProxy.createQueueSession(ManagedConnectionProxy.java:150)
	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.resource.AutoConnectionTracker$ConnectionInvocationHandler.invoke(AutoConnectionTracker.java:125)
	at $Proxy75.createQueueSession(Unknown Source)
	at
com.bmm.dao.jms.AQueueMessageSender.createSession(AQueueMessageSender.java:23)
	at com.bmm.dao.jms.AMessageSender.post(AMessageSender.java:112)
	at com.bmm.dao.jms.SynchronizerClient.post(SynchronizerClient.java:52)
	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:181)
	at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
	at
org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:176)
	at
org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:95)
	at sun.reflect.GeneratedMethodAccessor118.invoke(Unknown Source)
	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:181)
	at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
	at org.apache.openejb.cdi.CdiInterceptor.invoke(CdiInterceptor.java:129)
	at org.apache.openejb.cdi.CdiInterceptor.access$000(CdiInterceptor.java:45)
	at org.apache.openejb.cdi.CdiInterceptor$1.call(CdiInterceptor.java:66)
	at
org.apache.openejb.cdi.CdiInterceptor.aroundInvoke(CdiInterceptor.java:72)
	at sun.reflect.GeneratedMethodAccessor117.invoke(Unknown Source)
	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:181)
	at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
	at
org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:138)
	at
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:226)
	at
org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:178)
	at
org.apache.openejb.core.ivm.EjbObjectProxyHandler$AsynchronousCall.call(EjbObjectProxyHandler.java:296)
	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:886)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)




--
View this message in context: http://openejb.979440.n4.nabble.com/Strange-MDB-invocation-behavior-tp4656801p4657302.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Strange MDB invocation behavior

Posted by almos <al...@ukr.net>.
After a lot of investigation I've found a problem here on forum. I was using
TomEE v1.0 with ActiveMQ client jar v5.5.1 which has some bug or whatever.
Everything works smoothly with latest Tomee v1.1 build.
There are no exceptions, however I am periodically checking logs for any
kind of related problems. I'll let you know if any.
Thanks for the support.



--
View this message in context: http://openejb.979440.n4.nabble.com/Strange-MDB-invocation-behavior-tp4656801p4657321.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Strange MDB invocation behavior

Posted by Romain Manni-Bucau <rm...@gmail.com>.
I think you need one per tx. But dont worry real connections are normally
pooled for perf.
Le 6 sept. 2012 09:30, "almos" <al...@ukr.net> a écrit :

> I have added more logging and found that container occasionally issues
> following Exception when it sends JMS message.
> What the problem might be? I am creating connection in @PostConstruct
> method
> and then reusing it when posting messages (Session/Producers are created
> per
> send operations and not shared). Posting might occur from different
> threads.
> Should I create connection per message send operation or sharing Connection
> instance is fine?
>
> javax.jms.JMSException: The resource is allready being used in transaction
> context.
>         at
>
> org.apache.activemq.ra.ManagedTransactionContext.setUseSharedTxContext(ManagedTransactionContext.java:47)
>         at
>
> org.apache.activemq.ra.ManagedSessionProxy.setUseSharedTxContext(ManagedSessionProxy.java:67)
>         at
>
> org.apache.activemq.ra.ManagedConnectionProxy.createSessionProxy(ManagedConnectionProxy.java:122)
>         at
>
> org.apache.activemq.ra.ManagedConnectionProxy.createQueueSession(ManagedConnectionProxy.java:150)
>         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.resource.AutoConnectionTracker$ConnectionInvocationHandler.invoke(AutoConnectionTracker.java:125)
>         at $Proxy75.createQueueSession(Unknown Source)
>         at
>
> com.bmm.dao.jms.AQueueMessageSender.createSession(AQueueMessageSender.java:23)
>         at com.bmm.dao.jms.AMessageSender.post(AMessageSender.java:112)
>         at
> com.bmm.dao.jms.SynchronizerClient.post(SynchronizerClient.java:52)
>         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:181)
>         at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
>         at
>
> org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:176)
>         at
>
> org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:95)
>         at sun.reflect.GeneratedMethodAccessor118.invoke(Unknown Source)
>         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:181)
>         at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
>         at
> org.apache.openejb.cdi.CdiInterceptor.invoke(CdiInterceptor.java:129)
>         at
> org.apache.openejb.cdi.CdiInterceptor.access$000(CdiInterceptor.java:45)
>         at
> org.apache.openejb.cdi.CdiInterceptor$1.call(CdiInterceptor.java:66)
>         at
> org.apache.openejb.cdi.CdiInterceptor.aroundInvoke(CdiInterceptor.java:72)
>         at sun.reflect.GeneratedMethodAccessor117.invoke(Unknown Source)
>         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:181)
>         at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
>         at
>
> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:138)
>         at
>
> org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:226)
>         at
>
> org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:178)
>         at
>
> org.apache.openejb.core.ivm.EjbObjectProxyHandler$AsynchronousCall.call(EjbObjectProxyHandler.java:296)
>         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:886)
>         at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>         at java.lang.Thread.run(Thread.java:662)
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Strange-MDB-invocation-behavior-tp4656801p4657302.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>