5 Replies Latest reply on Mar 17, 2014 9:39 AM by Andreas G.

    JTA issue when starting a process from another thread

    Gareth Edwards Newbie

      Hello,

       

      I have a queue of objects which contain all the information required to start a new process session.

      Using Spring's @Scheduled annotation I'm periodically calling a method to poll the queue and start new workflows running.

      The problem is because of the scheduling the method is called using another thread and the following error below occurs:

       

       

      {code}

      Caused by: java.lang.IllegalStateException: Unable to find transaction: java:comp/UserTransaction

                at org.drools.persistence.jta.JtaTransactionManager.findUserTransaction(JtaTransactionManager.java:124) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

                at org.drools.persistence.jta.JtaTransactionManager.<init>(JtaTransactionManager.java:69) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

                at org.drools.persistence.SingleSessionCommandService.initTransactionManager(SingleSessionCommandService.java:303) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

                at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:117) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

                ... 24 more

      Caused by: javax.naming.NameNotFoundException: java:comp/UserTransaction

                at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:121)

                at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)

                at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_10]

                at org.drools.persistence.jta.JtaTransactionManager.findUserTransaction(JtaTransactionManager.java:119) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

                ... 27 more

       

      {code}

       

      I'm using jbpm 5.4 and JBoss 7.1

       

      I have read that using java:jboss/TransactionManager instead can resolve this issue but java:comp/UserTransaction is hard coded in the drools-persistence-jpa jar.

      Do I need to download the source and build another version of the jar?

      There must be a simple work around for this.

       

      Thanks in advance.

       

      Gareth.