1 Reply Latest reply on Jan 18, 2008 10:38 AM by anny_lut

    jboss 3.2.1 Local TM

    anny_lut Newbie

      We use jboss 3.2.1


      jboss sheduler starts client procedure (call this procedure shd_Client_Procedure), than this procedure executes bean's procedure (call bean_Procedure). Bean's procedure makes changes in DB(oracle) and than returns execution to shd_Client_Procedure. On the results of execution shd_Client_Procedure I have to commit or rollback DB changes.

      This bean is - BMT and stateful:


      <ejb-name>SvrProcDoc</ejb-name>
       <home>svrProcDoc.ejb.interfaces.SvrProcDocHome</home>
       <remote>svrProcDoc.ejb.interfaces.SvrProcDoc</remote>
       <ejb-class>svrProcDoc.ejb.bean.SvrProcDocBean</ejb-class>
       <session-type>Stateful</session-type>
       <transaction-type>Bean</transaction-type>


      In shd_Client_Procedure I start user transaction:

      InitialContext jndiCntx = new InitialContext();
       UserTransaction utr = (UserTransaction) jndiCntx.lookup("UserTransaction");
       utr.begin();


      When I begin to execute bean_Method, I try to monitor transaction status:

      UserTransaction utr = (UserTransaction) jndiCntx.lookup("UserTransaction");
       utr.getStatus();


      And I get javax.transaction.Status.STATUS_NO_TRANSACTION

      And when I make changes in DB, and return to shd_Client_Procedure, and then execute bean's procedure to rollback or commit, I get

      java.lang.IllegalStateException: No transaction.
       at org.jboss.tm.TxManager.commit(TxManager.java:147)
       at org.jboss.ejb.EnterpriseContext$UserTransactionImpl.commit(EnterpriseContext.java:477)
       at bars.kltoss.server.SvrPhaseW.commitPhase(SvrPhaseW.java:84)
       at svrProcDoc.ejb.bean.SvrProcDocBean.processDocCommit(SvrProcDocBean.java:121)
      


      What is the problem? In documentation I found that if I work in same JVM with Jboss it is possible to use LocalTransactionManager
      and I can spred my transaction like mine example.