Also we need to document that if there is a transaction we will be
continuing that transaction without trying nest the transactions. I know
nested transactions are tricky, so it is OK to not to support them. But we
need to clearly document this.

Thanks,
Ruwan

On Thu, Aug 27, 2009 at 7:38 AM, Ruwan Linton <[email protected]>wrote:

> Hi Rajika,
>
> I think you are right... please go ahead and provide a patch.
>
> Thanks,
> Ruwan
>
>
> On Wed, Aug 26, 2009 at 4:48 PM, Rajika Kumarasiri <[email protected]>wrote:
>
>> On Wed, Aug 26, 2009 at 12:02 PM, Rajika Kumarasiri <[email protected]>
>> wrote:
>> hi again,
>> I located the problem. This happens in ServiceTaskManager.java:396 where
>> we
>> create a new user transaction in the while loop. The problem occurs when
>> we
>> try to create a second transaction in the same thread which gives the
>> mentioned exception. I put the following check in which if a tranasction
>> is
>> already associated with the current thread of execution we'll live with
>> it(use-existing-one-or-new). If you are happy with it I can provide it as
>> a
>> patch.
>>
>> <code>
>>
>> if (transactionality == BaseConstants.TRANSACTION_JTA) {
>>            ut = getUserTransaction();
>>            if (ut.getStatus() == Status.STATUS_NO_TRANSACTION) {
>>                       ut.begin();
>>            }
>> }
>> </code>
>>
>> -Rajika
>>
>>
>>
>>
>> >
>> > On Sun, Aug 2, 2009 at 11:17 PM, Rajika Kumarasiri <[email protected]
>> >wrote:
>> > hello everybody,
>> > I just looked into the problem and it seems the current thread is
>> already
>> > associate with a transaction. I guess we need to get the status of the
>> > current transaction and if there is an existing one we need to join with
>> it
>> > otherwise we need to start a transaction.
>> >
>> > -Rajika
>> >
>> >
>> >
>> > hello everybody,
>> >> I am trying to use JTA transaction in JMS transport. I deployed the the
>> >> latest synapse war distribution(I studied that we need to have a JTA
>> >> provider within the J2EE server where we deploy synpase),  inside JBoss
>> >> 5.0.0 GA. It gives the following execption when I use a JTA trasaction
>> >> (<parameter name="transport.Transactionality">jta</parameter>). It
>> works
>> >> fine with local transactions(<parameter
>> >> name="transport.Transactionality">local</parameter>).  According to the
>> >> stack trace it's clear that we are trying to start a new transaction
>> inside
>> >> the JMS transport while another tx is already in progress.  Any help to
>> fix
>> >> the issue is higly appriciated. Thanks in advance.
>> >>
>> >> My axis2.xml configuration for JMS transport listner is as follows.
>> >>
>> >> <transportReceiver name='jms'
>> >> class='org.apache.axis2.transport.jms.JMSListener'>
>> >>         <parameter name='default' locked='false'>
>> >>             <parameter
>> >>
>> name='java.naming.factory.initial'>org.jnp.interfaces.NamingContextFactory</parameter>
>> >>             <parameter
>> >> name='java.naming.provider.url'>jnp://localhost:1099</parameter>
>> >>             <parameter
>> >>
>> name='java.naming.factory.url.pkgs'>org.jboss.naming:org.jnp.interfaces</parameter>
>> >>             <parameter
>> >>
>> name='transport.jms.ConnectionFactoryJNDIName'>ConnectionFactory</parameter>
>> >>             <parameter
>> name="transport.Transactionality">jta</parameter>
>> >>             <parameter
>> >> name="transport.UserTxnJNDIName">java:comp/UserTransaction</parameter>
>> >>          </parameter>
>> >>     </transportReceiver>
>> >>
>> >>
>> >> 21:51:41,679 INFO  [STDOUT] 21:51:41,678 ERROR [ServiceTaskManager]
>> >> Listener Task is already associated with a transaction
>> >> javax.transaction.NotSupportedException:
>> >> BaseTransaction.checkTransactionState -
>> >> [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated]
>> >> [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated]
>> >> thread is already associated with a transaction!
>> >>     at
>> >>
>> com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.begin(BaseTransaction.java:79)
>> >>     at
>> >>
>> com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.begin(BaseTransactionManagerDelegate.java:65)
>> >>     at
>> >>
>> org.jboss.tm.usertx.client.ServerVMClientUserTransaction.begin(ServerVMClientUserTransaction.java:137)
>> >>     at
>> >>
>> org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.run(ServiceTaskManager.java:394)
>> >>     at
>> >>
>> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:58)
>> >>     at
>> >>
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>> >>     at
>> >>
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>> >>     at java.lang.Thread.run(Thread.java:595)
>> >> 21:51:41,679 INFO  [STDOUT] 21:51:41,679 ERROR [NativeWorkerPool]
>> Uncaught
>> >> exception
>> >> org.apache.axis2.transport.jms.AxisJMSException: Listener Task is
>> already
>> >> associated with a transaction
>> >>     at
>> >>
>> org.apache.axis2.transport.jms.ServiceTaskManager.handleException(ServiceTaskManager.java:957)
>> >>     at
>> >>
>> org.apache.axis2.transport.jms.ServiceTaskManager.access$700(ServiceTaskManager.java:48)
>> >>     at
>> >>
>> org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.run(ServiceTaskManager.java:397)
>> >>     at
>> >>
>> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:58)
>> >>     at
>> >>
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>> >>     at
>> >>
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>> >>     at java.lang.Thread.run(Thread.java:595)
>> >> Caused by: javax.transaction.NotSupportedException:
>> >> BaseTransaction.checkTransactionState -
>> >> [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated]
>> >> [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated]
>> >> thread is already associated with a transaction!
>> >>     at
>> >>
>> com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.begin(BaseTransaction.java:79)
>> >>     at
>> >>
>> com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.begin(BaseTransactionManagerDelegate.java:65)
>> >>     at
>> >>
>> org.jboss.tm.usertx.client.ServerVMClientUserTransaction.begin(ServerVMClientUserTransaction.java:137)
>> >>     at
>> >>
>> org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.run(ServiceTaskManager.java:394)
>> >>     ... 4 more
>> >> 21:51:41,697 INFO  [STDOUT] 21:51:41,678 ERROR [ServiceTaskManager]
>> >> Listener Task is already associ
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> http://wso2.org
>> >> http://llvm.org
>> >> http://www.minix3.org/
>> >>
>> >>
>> >>
>> >
>> >
>> > --
>> > http://wso2.org
>> > http://llvm.org
>> > http://www.minix3.org/
>> >
>> >
>> >
>>
>>
>> --
>> http://wso2.org
>> http://llvm.org
>> http://www.minix3.org/
>>
>
>
>
> --
> Ruwan Linton
> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
> WSO2 Inc.; http://wso2.org
> email: [email protected]; cell: +94 77 341 3097
> blog: http://ruwansblog.blogspot.com
>



-- 
Ruwan Linton
Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org
email: [email protected]; cell: +94 77 341 3097
blog: http://ruwansblog.blogspot.com

Reply via email to