Discussion:
[jboss-user] [jBPM] - Local human task service doesn't participate in a JTA transaction
Jboss fan99
2013-03-09 22:54:01 UTC
Permalink
Jboss fan99 [https://community.jboss.org/people/devinderpal] created the discussion

"Local human task service doesn't participate in a JTA transaction"

To view the discussion, visit: https://community.jboss.org/message/801737#801737

--------------------------------------------------------------
Our product release is end of the month and we just found out this bug. Will really appreciate any help in resolving it.

Using jBPM 5.2 with MySQL DB and JBoss 7.1.0

I have a stateless session bean method that runs in a transaction
public void doSomething()
{
     // blah blah
     humanTaskService.start( taskId, userId);
    humanTaskService.complete( taskId, userId, contentData);
      //blah blah
      throw NullPointerException
}

Now the above task is complete and not rolled back. I have attached persistence.xml used for my project.
Also the way I'm starting the local human task server is below:

TaskService humanTaskService = new TaskService(jbpmEmf,
                                        SystemEventListenerFactory.getSystemEventListener());
                    humanTaskServiceSession = humanTaskService.createSession();
                    humanTaskServiceSession.setTransactionType("local-JTA");
                    SyncWSHumanTaskHandler humanTaskHandler = new SyncWSHumanTaskHandler(
                                        new LocalTaskService(humanTaskServiceSession), ksession);
                    humanTaskHandler.setLocal(true);
                    humanTaskHandler.connect();
                    ksession.getWorkItemManager().registerWorkItemHandler("Human Task", humanTaskHandler);

Please help.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/801737#801737]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Mauricio Salatino
2013-03-09 23:11:29 UTC
Permalink
Mauricio Salatino [https://community.jboss.org/people/salaboy21] created the discussion

"Re: Local human task service doesn't participate in a JTA transaction"

To view the discussion, visit: https://community.jboss.org/message/801738#801738

--------------------------------------------------------------
Can you explain what is this:
com.mycompany.db.MyCompanyTransactionManager ???
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/801738#801738]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Jboss fan99
2013-03-10 01:00:24 UTC
Permalink
Jboss fan99 [https://community.jboss.org/people/devinderpal] created the discussion

"Re: Local human task service doesn't participate in a JTA transaction"

To view the discussion, visit: https://community.jboss.org/message/801744#801744

--------------------------------------------------------------
Mauricio,
  Thanks for your reply.
I have attached MyCompanyTransactionManager. Please note than I'm not allowed to share the original code, so classname and package are changed. But contents are accurate.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/801744#801744]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Jboss fan99
2013-03-10 01:02:19 UTC
Permalink
Jboss fan99 [https://community.jboss.org/people/devinderpal] created the discussion

"Re: Local human task service doesn't participate in a JTA transaction"

To view the discussion, visit: https://community.jboss.org/message/801745#801745

--------------------------------------------------------------
sorry, here is the file
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/801745#801745]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Mauricio Salatino
2013-03-12 14:02:57 UTC
Permalink
Mauricio Salatino [https://community.jboss.org/people/salaboy21] created the discussion

"Re: Local human task service doesn't participate in a JTA transaction"

To view the discussion, visit: https://community.jboss.org/message/802132#802132

--------------------------------------------------------------
I will not review that, because that's not part of the jbpm codebase, if you decided to add your own TransactionManager, you need to make sure that it works correctly and that its not causing issues with the frameworks that use it.

Cheers
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/802132#802132]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Jboss fan99
2013-03-12 17:14:08 UTC
Permalink
Jboss fan99 [https://community.jboss.org/people/devinderpal] created the discussion

"Re: Local human task service doesn't participate in a JTA transaction"

To view the discussion, visit: https://community.jboss.org/message/802168#802168

--------------------------------------------------------------
Mauricio,
  I'm not using my own TransactionManager. It's a transaction manager lookup class. May be name of the file is not best.
It's a small lookup class that just returns transaction manager bound in *"java:jboss/TransactionManager"*

By defaut jBPM looks in java:/TransactionManager. That's why this lookup class was added. Below is the code of this class

public class MyCompanyTransactionManager implements TransactionManagerLookup {
        public Object getTransactionIdentifier(Transaction transaction){
                return transaction;
        }
        public TransactionManager getTransactionManager(Properties props)
                        throws HibernateException{
                try
                {
                    return (TransactionManager) new InitialContext()
                      .lookup("java:jboss/TransactionManager");
                }
                catch (NamingException e)
                {
                    throw new RuntimeException(e);
                }
        }
        public String getUserTransactionName(){
                return null;
        }
        public static TransactionManager getTransactionManager(){
                return new MyCompanyTransactionManager().getTransactionManager(null);
        }
}

Thanks!
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/802168#802168]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Mauricio Salatino
2013-03-13 21:19:25 UTC
Permalink
Mauricio Salatino [https://community.jboss.org/people/salaboy21] created the discussion

"Re: Local human task service doesn't participate in a JTA transaction"

To view the discussion, visit: https://community.jboss.org/message/802490#802490

--------------------------------------------------------------
Did you try with using just one Persistence Unit?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/802490#802490]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Demian Calcaprina
2013-03-13 21:47:41 UTC
Permalink
Demian Calcaprina [https://community.jboss.org/people/calca] created the discussion

"Re: Local human task service doesn't participate in a JTA transaction"

To view the discussion, visit: https://community.jboss.org/message/802494#802494

--------------------------------------------------------------
Hey, I suggest you try 5.3 or 5.4 and see how it goes..

5.2  local persistence was a bit different:
https://github.com/droolsjbpm/jbpm/blob/d75849efdb4b149e7169237a5282e7882e701f85/jbpm-human-task/src/main/java/org/jbpm/task/service/TaskServiceSession.java https://github.com/droolsjbpm/jbpm/blob/d75849efdb4b149e7169237a5282e7882e701f85/jbpm-human-task/src/main/java/org/jbpm/task/service/TaskServiceSession.java You can see it getting the UserTransaction java:comp/UserTransaction, instead from 5.3 you can see there is a Task TransactionManager:
https://github.com/droolsjbpm/jbpm/blob/master/jbpm-human-task/jbpm-human-task-core/src/main/java/org/jbpm/task/service/persistence/TaskJTATransactionManager.java https://github.com/droolsjbpm/jbpm/blob/master/jbpm-human-task/jbpm-human-task-core/src/main/java/org/jbpm/task/service/persistence/TaskJTATransactionManager.java

If you make some simple unit test in 5.3 or 5.4 I can take a look.

Thanks

Demian
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/802494#802494]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Jboss fan99
2013-03-15 18:27:01 UTC
Permalink
Jboss fan99 [https://community.jboss.org/people/devinderpal] created the discussion

"Re: Local human task service doesn't participate in a JTA transaction"

To view the discussion, visit: https://community.jboss.org/message/803027#803027

--------------------------------------------------------------
Thanks for your responses.
Without making any changes, I was trying to understand this behavior. And I noticed that rollback only fails when I use debugger and try to see the execution by putting breakpoints and going line by line. If no breakpoints are used, rollback work correctly. First time I saw this problem, I was also using debugger.

But I still don't understand why this behavior when using debugger. I guess some kind of timeout is happening due to which rollback doesn't work. If this is a timeout issue, it has to be very small timeout. maybe couple of seconds. Because even when debugging I'm not waiting minutes but going line by line quickly.. may be just delay of 4-5 secs. Without understanding the issue, I'm not sure if it can happen in production too.

Please let me know if you can put some light on it.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/803027#803027]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Mauricio Salatino
2013-03-15 18:38:57 UTC
Permalink
Mauricio Salatino [https://community.jboss.org/people/salaboy21] created the discussion

"Re: Local human task service doesn't participate in a JTA transaction"

To view the discussion, visit: https://community.jboss.org/message/803030#803030

--------------------------------------------------------------
Good to know that you find the issue. and as far as I remember the default transaction time out is 5 seconds. Which IMO is ok. The Bitronix documentation mention 60 seconds here: http://docs.codehaus.org/display/BTM/Configuration http://docs.codehaus.org/display/BTM/Configuration, but I guess that the underlying DB is closing the connection after 5 seconds.
Can you share the stack trace? if everything goes ok inside the method invocation, it shoudn't take more than 5 secs at least not for the jBPM side.

Cheers
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/803030#803030]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Jboss fan99
2013-03-15 19:21:35 UTC
Permalink
Jboss fan99 [https://community.jboss.org/people/devinderpal] created the discussion

"Re: Local human task service doesn't participate in a JTA transaction"

To view the discussion, visit: https://community.jboss.org/message/803034#803034

--------------------------------------------------------------
Mauricio,
  jBPM is not taking more than 5 secs. When using debugger, I was stopping the execution by putting breakpoint. So that's why it was timing out.
I'm good for now. Hopefully everything will work in production

Thanks for your time.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/803034#803034]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...