6 Replies Latest reply on Jul 12, 2019 6:00 AM by Ondrej Chaloupka

    JBoss5.1 JTA TransactionInProgress

    alkesh b Newbie

      Using JBoss 5.1 , Arjuna

      This may be basic question but Let say I have EJB A & EJB B.

       

      Client -(Calls) -> EJB A (Managed transaction)

      EJB A -(Calls) ->() EJB B (Managed transaction)

      At this point Jboss prints.. Logs get printed as 019-07-02 22:03:59,593 WARN  [com.arjuna.ats.jta.logging.loggerI18N] (TRADE_SU#BPS) [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.multipleWarning] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.multipleWarning] Multiple last resources have been added to the current transaction. This is transactionally unsafe and should not be relied upon. Current resource is org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@a07c8423

       

      When EJB B gets completed, it tries to commit transaction. but error message is Could not commit transaction. with following exception

      javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Could not commit transaction.

       

       

      I have tried to set transaction attribute but its not working somehow.

       

      ejb-jar.xml

      <container-transaction id="MethodTransaction_15">

                  <method id="MethodElement_15">

                     <ejb-name>EJBA</ejb-name>

                     <method-name>*</method-name>

                  </method>

                  <trans-attribute>Required</trans-attribute>

               </container-transaction>

      <container-transaction id="MethodTransaction_15">

                  <method id="MethodElement_15">

                     <ejb-name>EJBB</ejb-name>

                     <method-name>*</method-name>

                  </method>

                  <trans-attribute>RequiresNew</trans-attribute>

               </container-transaction>

       

      so my question is, Is there any way to create a new transaction for EJB B instead of adding it to EJB A transaction? Is there any way to set transaction attribute in local ejb?

       

      How can i debug if which transaction attribute EJB is using?

       

      this works perfactly in WebSphere 8.5, Any hint will be very helpful.

        • 1. Re: JBoss5.1 JTA TransactionInProgress
          Thomas Jenkinson Master

          Hi Alkesh,

           

          This question relates to JBoss AS 5.1 which is pretty old now (released in 2009). Please can you try the same on WildFly 17 and see if you get the same behaviour? Do be aware though there have been many many improvements between then and now (bug fixes, enhancements, Java EE versions).

           

          If that is not possible you will be best placed to ask the question over in the jbossas space: JBoss AS

           

          PS it looks like you configured your datasource as a non-XA datasource so it is probably that which is the problem (assuming you are using EJB home / CORBA for the EJB->EJB comms).

           

          Thanks for your interest in Narayana!

          Tom

          • 2. Re: JBoss5.1 JTA TransactionInProgress
            Thomas Jenkinson Master

            It looks like I had permissions to move this for you

            • 3. Re: JBoss5.1 JTA TransactionInProgress
              Ondrej Chaloupka Master

              Yes, indeed you as Tom suggested. You should check the configuration of your datasources. You probably configured the datasource and not the xa datasource.

               

              As the code worked with WebSphere before and from the descriptor you provided it seems it's configured correctly. But just to mention - it's necessary that the local ejb call (at least I understand you run both EJBs at one server) needs to be done through injected ejb instance for the ejb would be managed by container (like our CDI doc talks about difference of injected and not injected CDI bean instance - Developer Guide ).

              • 4. Re: JBoss5.1 JTA TransactionInProgress
                alkesh b Newbie

                Thanks,

                 

                I am using 2.0 so Can you share some link about 2.0 Jboss configuration?

                I understand issue is with EJB calling other EJB and managing transaction flow these calls should not be part of one transaction. I am not yet found solution for right configuration but I trying to find out configuration.

                EJB A calls local EJB B (should start in new transaction) and EJB A should commit its transaction when it gets completed without waiting for EJB B

                • 5. Re: JBoss5.1 JTA TransactionInProgress
                  Thomas Jenkinson Master

                  Transaction propagation should work well in WildFly 17 I know that, are you able to upgrade to that version?

                   

                  Please clarify what you mean when you say you are using 2.0 as I think you are trying to run on 5.1?

                  • 6. Re: JBoss5.1 JTA TransactionInProgress
                    Ondrej Chaloupka Master

                    Are those EJBs running on different WildFly servers or the call is just from one EJB to other EJB in the same JVM?

                     

                    In general you will need the Local/Remote and Home interface. You can investigate on examples of EJB calls in the WildFly testsuite (wildfly/Session30Bean.java at master · wildfly/wildfly · GitHub ). When you clone the WildFly github repo you can check the code of the tests. They are small applications testing particular functionality. When you go through few of them you could find the setup you need.

                    But in general, the WildFly works with EJB2 by spec so you can just take a look at some tutorial elsewhere on the web 1, 2, 3, 4, ...