11 Replies Latest reply on Aug 4, 2008 2:39 PM by chrisxsb

    Unable to locate current JTA transaction

    crussell42

      When I deploy the jbpm-enterprise.ear to jboss 4.0.5ga and try to log into the
      jbpm-console web app I am getting the following error.
      Unable to locate current JTA transaction

      16:56:02,784 ERROR [STDERR] Jan 29, 2007 4:56:02 PM com.sun.facelets.FaceletViewHandler handleRenderException
      SEVERE: Error Rendering View[/main/user/usertasklist.xhtml]
      javax.el.ELException: /search/form/formtemplate.xhtml @14,73 session="#{jbpmBean.jbpmContext.session}": org.hibernate.HibernateException: Unable to locate current JTA transaction
       at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76)
       at org.jbpm.webapp.tag.jbpm.ui.Search.getSession(Search.java:47)
       at org.jbpm.webapp.tag.jbpm.ui.UICriteria.initialize(UICriteria.java:72)
       at org.jbpm.webapp.tag.jbpm.ui.UICriteria.initialize(UICriteria.java:134)
       at org.jbpm.webapp.tag.jbpm.ui.UICriteria.getSearchBean(UICriteria.java:229)
       at org.jbpm.webapp.tag.jbpm.ui.Search.initialize(Search.java:191)
       at org.jbpm.webapp.tag.jbpm.ui.Search.encodeBegin(Search.java:92)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:882)
       at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:810)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:884)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:890)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:890)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:578)
      


      Here is the pertinent hibernate.cfg.xml part
       <!-- JBoss transaction manager lookup (begin) -->
       <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
       <!-- JBoss transaction manager lookup (end) -->
      
       <!-- DataSource properties (begin) -->
       <property name="hibernate.connection.datasource">java:/DefaultDS</property>
       <!-- DataSource properties (end) -->
      
       <!-- JTA transaction properties (begin) ===
       <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
       <property name="jta.UserTransaction">java:comp/UserTransaction</property>
       ==== JTA transaction properties (end) -->
      
       <!-- CMT transaction properties (begin) -->
       <property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
       <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
       <!-- CMT transaction properties (end) -->
      


        • 1. Re: Unable to locate current JTA transaction
          crussell42

          http://www.jboss.com/index.html?module=bb&op=viewtopic&t=99366&postdays=0&postorder=asc&start=0
          Found the solution in this posting.
          Had to change config option in jbpm.cfg.cml to false.
          Not sure why this is but it seems to fix things

           <field name="isCurrentSessionEnabled"><false /></field>
          


          • 2. Re: Unable to locate current JTA transaction
            crussell42

            ALthough the jbpm-console seems to work like this, lots of exceptions are spewed mostly

            org.hibernate.TransactionException: Could not register synchronization for container transaction Could not register synchronization for container transaction.
            

            So is there a nice easy way to turn on JTA or CMT ?
            See the post mentioned above as it philosiphises but never determines
            how to make 3.2.beta1 use either CMT or JTA it only describes how
            to disable isCurrentSessionEnabled.

            • 3. Re: Unable to locate current JTA transaction
              crussell42

              In poking around and finally getting into building jbpm-enterprise.ear from the
              cvs head, I got a little further in my testing. Because I cant figure out how to configure transactions properly, I just tried to turn them off by editing the
              jbpm.cfg.xml and setting

              <field name="isCurrentSessionEnabled"><false /></field>
              <field name="isTransactionEnabled"><false /></field>
              

              Then I started getting some exceptions withing the JbpmPhaseListener and started lookuing at DbPersistenceService and found this bug.
              http://jira.jboss.com/jira/browse/JBPM-833
              I fixed my source version and this gets me to the next set of exceptions.
              These seem to have to do with jini naming of the
              TimerServiceBean. For some reason when I deploy the ear, jboss is picking up and configuring the CommandServiceBean properly to "ejb/CommandServiceBean" but
              the TimerServiceBean is not being registered as expected
              14:55:45,045 INFO [EARDeployer] Init J2EE application: file:/usr/local/jboss-4.0.5.GA/server/messaging/deploy/jbpm-enterprise.ear
              14:55:47,436 INFO [EjbModule] Deploying CommandServiceBean
              14:55:47,504 INFO [EjbModule] Deploying TimerServiceBean
              14:55:47,540 INFO [EjbModule] Deploying CommandListenerBean
              14:55:47,565 INFO [EjbModule] Deploying JobListenerBean
              14:55:47,678 INFO [BaseLocalProxyFactory] Bound EJB LocalHome 'CommandServiceBean' to jndi 'CommandServiceBean'
              14:55:47,694 INFO [ProxyFactory] Bound EJB Home 'CommandServiceBean' to jndi 'ejb/CommandServiceBean'
              14:55:47,736 INFO [BaseLocalProxyFactory] Bound EJB LocalHome 'TimerServiceBean' to jndi 'local/TimerServiceBean@743673026'
              

              And so we get the exception and message "ejb local timer lookup problem".
              Could use help here if anyone has an idea???

              • 4. Re: Unable to locate current JTA transaction
                crussell42

                Also needed to apply this fix for compiling the cvs head.
                http://jira.jboss.com/jira/browse/JBPM-834

                All I wanted was a Pepsi !!!

                No really, I'm just trying not to lose any information on how to get the beast to run with Jboss 4.0.5GA, ejb3, jms messaging, and annotated class persistence in a ContextInstance. This forum will help me do that and maybe help others.
                Other postings include but are not limited to
                http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4003457#4003457
                http://www.jboss.com/index.html?module=bb&op=viewtopic&t=99670
                http://www.jboss.com/index.html?module=bb&op=viewtopic&t=100452

                • 5. Re: Unable to locate current JTA transaction
                  crussell42

                  Ok, doing pretty well now but when I try to signal a transition to an end state I get the following:
                  See JIRA ISSUE http://jira.jboss.com/jira/browse/JBPM-836

                  ===EXCEPTION SEEN===
                  13:04:56,785 ERROR [ProcessInstanceBean$SignalTokenListener] Action threw an exception: ejb local timer lookup problem
                  
                  ===CODE FIXES FOR EXCEPTION==
                  RCS file: /cvsroot/jbpm/jbpm.3/enterprise/src/main/java/org/jbpm/scheduler/ejbtimer/EjbSchedulerService.java,v
                  retrieving revision 1.1
                  diff -r1.1 EjbSchedulerService.java
                  31c31,36
                  < LocalTimerServiceHome localTimerServiceHome = (LocalTimerServiceHome) initial.lookup("java:comp/env/ejb/LocalTimerServiceBean");
                  ---
                  >
                  >
                  > //RSC wrong name used
                  > //LocalTimerServiceHome localTimerServiceHome = (LocalTimerServiceHome) initial.lookup("java:comp/env/ejb/LocalTimerServiceBean");
                  > //See also change to jboss.xml to include TimerServiceBean or this fix wont work either.
                  > LocalTimerServiceHome localTimerServiceHome = (LocalTimerServiceHome) initial.lookup("TimerServiceBean");
                  
                  
                  
                  RCS file: /cvsroot/jbpm/jbpm.3/enterprise/src/main/resources/jar/META-INF/jboss.xml,v
                  retrieving revision 1.2
                  diff -r1.2 jboss.xml
                  12a13,20
                  > <!-- RSC ADDED THIS -->
                  > <session>
                  > <ejb-name>TimerServiceBean</ejb-name>
                  > <jndi-name>ejb/TimerServiceBean</jndi-name>
                  > <local-jndi-name>TimerServiceBean</local-jndi-name>
                  > </session>
                  >
                  >
                  


                  • 6. Re: Unable to locate current JTA transaction
                    crussell42

                    Ok, at this point things are running pretty well.
                    I have deployed the cvs trunk build jbpm.3 (3.2.beta2)'s jbpm-enterprise.ear to
                    jboss4.0.5ga with ejb3 and messaging.
                    I am able to create start and transition through process;s.
                    Keep in mind the reason for this posting.
                    We have isTransactionEnabled set to false and isCurrentSessionEnabled set to false.
                    So here I almost have it working with Transactions turned OFF.
                    When a process transitions to an end state however and the clean up of the process instance begins, I get the following exception:

                    16:26:00,719 ERROR [STDERR] org.hibernate.TransactionException: Could not register synchronization
                     at org.hibernate.transaction.CMTTransaction.registerSynchronization(CMTTransaction.java:159)
                     at org.jbpm.db.JobSession.deleteJobsForProcessInstance(JobSession.java:214)
                     at org.jbpm.scheduler.ejbtimer.EjbSchedulerService.deleteTimersByProcessInstance(EjbSchedulerService.java:165)
                     at org.jbpm.graph.exe.ProcessInstance.end(ProcessInstance.java:276)
                    

                    So back to the original question, HOW DO I PROPERLY CONFIGURE USE OF EITHER JTA OR CMT TRANSACTIONS?????????
                    I've managed to make it hobble along with the transactions turned off (I think) but what I really want is to properly configure transactions....
                    PLEASE HELP!

                    • 7. Unable to locate current JTA transaction

                      I am also getting the same error. I am working on jbpm3.2.2\jbpm-jpdl-3.2.2 & websphere 6. I am able to connect and give token.signal but at state-end i am getting this error.

                      org.jbpm.db.JobSession deleteJobsForProcessInstance org.hibernate.TransactionException: Could not register synchronization
                      

                      Can you please help me. I already running behind time. and saw all sites from almost 2 weeks. but still not getting any solution.....

                      plz help me.

                      my jbpm.cfg.xml is
                      
                      <jbpm-configuration>
                      
                       <jbpm-context>
                       <service name="persistence">
                       <factory>
                       <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
                       <field name="isTransactionEnabled"><false /></field>
                       <field name="isCurrentSessionEnabled"><false /></field>
                       </bean>
                       </factory>
                       </service>
                       <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
                       <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
                       <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
                       <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
                       <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
                       </jbpm-context>
                      
                       <!-- configuration resource files pointing to default configuration files in jbpm-{version}.jar -->
                       <string name="resource.hibernate.cfg.xml" value="hibernate.cfg.xml" />
                       <!-- <string name="resource.hibernate.properties" value="hibernate.properties" /> -->
                       <string name="resource.business.calendar" value="org/jbpm/calendar/jbpm.business.calendar.properties" />
                       <string name="resource.default.modules" value="org/jbpm/graph/def/jbpm.default.modules.properties" />
                       <string name="resource.converter" value="org/jbpm/db/hibernate/jbpm.converter.properties" />
                       <string name="resource.action.types" value="org/jbpm/graph/action/action.types.xml" />
                       <string name="resource.node.types" value="org/jbpm/graph/node/node.types.xml" />
                       <string name="resource.parsers" value="org/jbpm/jpdl/par/jbpm.parsers.xml" />
                       <string name="resource.varmapping" value="org/jbpm/context/exe/jbpm.varmapping.xml" />
                      
                       <bean name="jbpm.task.instance.factory" class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl" singleton="true" />
                       <bean name="jbpm.variable.resolver" class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true" />
                       <long name="jbpm.msg.wait.timout" value="5000" singleton="true" />
                      
                      
                      </jbpm-configuration>
                      
                      

                      my hibernate.cfg.xml is as follows
                       <property name="hibernate.dialect">org.hibernate.dialect.Oracle9iDialect</property>
                      
                      
                       <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
                      
                       <!-- Websphere -->
                       <property name="hibernate.jdbc.batch_size">0</property>
                       <property name="hibernate.connection.datasource">jdbc/JbpmDS</property>
                       <property name="hibernate.TransactionManagerLookup">org.hibernate.transaction.WebSphereExtendedJTATransactionLookup</property>
                       <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.WebSphereExtendedJTATransactionLookup</property>
                       <property name="hibernate.TransactionManagerLookupStrategy">org.hibernate.transaction.WebSphereExtendedJTATransactionLookup</property>
                       <property name="transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
                       <property name="hibernate.show_sql">true</property>
                      
                      
                       <property name="hibernate.transaction.flush_before_completion">true</property>
                      


                      • 8. Re: Unable to locate current JTA transaction
                        preitsma

                        I ran into http://jira.jboss.com/jira/browse/JBPM-836 some time ago on 3.2.1 and applied the fix to jbpm-enterprise.ear. Quite surprised to run into it again after my upgrade to 3.2.2.

                        Could this be permanently fixed in the next release ?

                        • 9. Re: Unable to locate current JTA transaction
                          kukeltje

                          The issue was never formally fixed (it is still open). So no real surprise that it is still an issue in 3.2.2. I've set the fix version to 3.3 so it does not slip of the radar

                          • 10. Re: Unable to locate current JTA transaction
                            kukeltje

                            3.2.3 that should say.

                            • 11. Re: Unable to locate current JTA transaction

                               

                              "shilpa.kumar@indussoft.com" wrote:
                              I am also getting the same error. I am working on jbpm3.2.2\jbpm-jpdl-3.2.2 & websphere 6. I am able to connect and give token.signal but at state-end i am getting this error.
                              org.jbpm.db.JobSession deleteJobsForProcessInstance org.hibernate.TransactionException: Could not register synchronization
                              

                              Can you please help me. I already running behind time. and saw all sites from almost 2 weeks. but still not getting any solution.....



                              I don't have a solution, but I'm experiencing the same problem, I think. In my case, I'm manually clicking "End" while viewing a process instance in the jbpm-console web app.

                              I've followed the stack traces and found that the reason that the synchronization couldn't be registered is because of a NullPointerException that occurs inside CMTTransaction on line 156:

                              154: public void registerSynchronization(Synchronization sync) throws HibernateException {
                              155: try {
                              156: getTransaction().registerSynchronization(sync);
                              157: }
                              158: catch (Exception e) {
                              159: throw new TransactionException("Could not register synchronization", e);
                              160: }
                              161: }
                              


                              So for some reason, getTransaction() is returning null...