Hello Jonas team,

 

Can please somebody explain why is this error happening?

We are using Jonas 2.3 and this is the Jonas code which causes the exception

 

            // Send the XA start to the XAResource

            // This code raises several issues:     XXX

            // 1) We should set the flag TMRESUME if the resource was previously

            //    suspended by end(TMSUSPEND) !!!

            // 2) A new Xid branch should be generated in case of new RM (if !found)

            //    See JTA Specifications, page 12/13.

            int flag = found ? XAResource.TMJOIN : XAResource.TMNOFLAGS;

            try {

                xares.start(myCtx.getXid(), flag);

            } catch (XAException e) {

                        throw new SystemException("Cannot send XA start:"+e);

            }

 

We found out that this was cause by bug in our code,

Session bean with transaction attribute Supports (getMatching) calls Entity bean with transaction attribute supports (getData) and that calls another Entity bean (Jonas generated finder findAllInScope) which doesn't have any transaction attribute (we forgot to set one ;-) and the default value is set to Required.

This calls looks like it is trying to create transaction and it fails.

Can you think about reason why is it failing? These are the rules how we set transaction attributes, Session beans Supports for read-only methods and Required for read/write methods. Entity beans Supports for read-only methods and Mandatory for read/write methods. Both have Required as default for non specified methods.

 

javax.transaction.SystemException: Cannot send XA start:javax.transaction.xa.XAException: XA START: mixed transactions

            at org.objectweb.jonas_tm.TransactionImpl.enlistResource(TransactionImpl.java:268)

            at org.objectweb.jonas_tm.Current.doAttach(Current.java:589)

            at org.objectweb.jonas_tm.Current.begin(Current.java:152)

            at org.objectweb.jonas_ejb.container.JContainerImpl.checkTransactionIn(JContainerImpl.java:456)

            at org.objectweb.jonas_ejb.container.JEntityHome.preinvoke(JEntityHome.java:249)

            at com.compuware.aqp.beans.testcase.JOnAScom_compuware_aqp_beans_testcase_TestExecPropHome.findAllInScope(JOnAScom_compuware_aqp_beans_testcase_TestExecPropHome.java:172)

            at com.compuware.aqp.beans.testcase.TestCaseBean.getData(TestCaseBean.java:893)

            at com.compuware.aqp.beans.testcase.JOnAScom_compuware_aqp_beans_testcase_TestCaseRemote.getData(JOnAScom_compuware_aqp_beans_testcase_TestCaseRemote.java:824)

            at com.compuware.cgf.beans.core.CoreDocumentStatelessControllerBean.dbget(CoreDocumentStatelessControllerBean.java:828)

            at com.compuware.cgf.beans.core.CoreDocumentStatelessControllerBean.getAll(CoreDocumentStatelessControllerBean.java:916)

            at com.compuware.cgf.beans.core.CoreDocumentStatelessControllerBean.executeQuery(CoreDocumentStatelessControllerBean.java:5679)

            at com.compuware.cgf.beans.core.CoreDocumentStatelessControllerBean.getMatching(CoreDocumentStatelessControllerBean.java:1532)

            at com.compuware.aqp.beans.testcase.JOnAScom_compuware_aqp_beans_testcase_TestCaseControllerRemote.getMatching(JOnAScom_compuware_aqp_beans_testcase_TestCaseControllerRemote.java:850)

            at com.compuware.cgf.servlets.query.QueryServletPeer.search(QueryServletPeer.java:483)

            at com.compuware.cgf.servlets.query.QueryServlet.processPost(QueryServlet.java:162)

            at com.compuware.cgf.servlets.core.CoreDocumentServlet.doPost(CoreDocumentServlet.java:624)

            at com.compuware.cgf.servlets.session.SessionServlet.service(SessionServlet.java:537)

            at com.compuware.cgf.servlets.session.SessionServlet.service(SessionServlet.java:456)

            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

            at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:488)

            at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:403)

            at org.mortbay.http.HandlerContext.handle(HandlerContext.java:1046)

            at org.mortbay.http.HandlerContext.handle(HandlerContext.java:1001)

            at org.mortbay.http.HttpServer.service(HttpServer.java:697)

            at org.mortbay.http.HttpConnection.service(HttpConnection.java:745)

            at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:918)

            at org.mortbay.http.HttpConnection.handle(HttpConnection.java:760)

            at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:148)

            at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:287)

            at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:716)

            at java.lang.Thread.run(Unknown Source)

 

Thanks a lot,

 

Miro Halas

 

Reply via email to