[jboss-user] [jBPM] - Human Task Service transactions fail

Grigory Kalabin do-not-reply at jboss.com
Mon Oct 1 12:19:35 EDT 2012


Grigory Kalabin [https://community.jboss.org/people/gkalabin] created the discussion

"Human Task Service transactions fail"

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

--------------------------------------------------------------
Hi everybody!

I'm using jBPM 5.3.0.Final (except jbpm-human-task which version is 5.3.0.CR1, because something is wrong with my pom.xml or maven repo) and JBoss 7.1.1.

I'm trying to run jbpm with human task service.

When I start processes without human tasks everything works fine. But when I try to run process with human task I get the following exception (see full error log in attachments):


20:04:37,710 ERROR [stderr] (NioProcessor-4) Caused by: java.lang.NullPointerException
20:04:37,715 ERROR [stderr] (NioProcessor-4)    at org.jbpm.task.service.persistence.TaskJTATransactionManager.getStatus(TaskJTATransactionManager.java:70)
20:04:37,726 ERROR [stderr] (NioProcessor-4)    at org.jbpm.task.service.persistence.TaskJTATransactionManager.ownsTransaction(TaskJTATransactionManager.java:28)
20:04:37,737 ERROR [stderr] (NioProcessor-4)    at org.jbpm.task.service.persistence.TaskPersistenceManager.beginTransaction(TaskPersistenceManager.java:50)
20:04:37,749 ERROR [stderr] (NioProcessor-4)    at org.jbpm.task.service.TaskServiceSession.doOperationInTransaction(TaskServiceSession.java:887)
20:04:37,754 ERROR [stderr] (NioProcessor-4)    ... 28 more



I init HumanTaskService and jBPM like:

Environment JBPM_ENVIRONMENT = KnowledgeBaseFactory.newEnvironment();
JBPM_ENVIRONMENT.set(EnvironmentName.ENTITY_MANAGER_FACTORY, Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa"));
JBPM_ENVIRONMENT.set(EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager());
JBPM_ENVIRONMENT.set(EnvironmentName.GLOBALS, new MapGlobalResolver());
 
Properties properties = new Properties();
properties.put("drools.processInstanceManagerFactory", "org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory");
properties.put("drools.processSignalManagerFactory", "org.jbpm.persistence.processinstance.JPASignalManagerFactory");
KnowledgeSessionConfiguration JBPM_CONFIG = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);
 
EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.task");
TaskService taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener());
 
MinaTaskServer taskServer = new MinaTaskServer(taskService);
// start the server
Thread thread = new Thread(taskServer);
thread.start();
 
TaskClient taskClient = new TaskClient(new MinaTaskClientConnector("myHtsClient",
                new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));
if (!taskClient.connect(TASK_CLIENT_SERVER_ADDRESS, TASK_CLIENT_SERVER_PORT)) {
     logger.error("Could not connect task client");
}
 
StatefulKnowledgeSession session = JPAKnowledgeService.newStatefulKnowledgeSession(readKnowledgeBase(), JBPM_CONFIG, JBPM_ENVIRONMENT);
session.getWorkItemManager().registerWorkItemHandler("Human Task", new CommandBasedWSHumanTaskHandler(session));


And my persistence.xml looks like:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
             xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
  
    <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>
        <mapping-file>META-INF/JBPMorm-JPA2.xml</mapping-file>
  
        <class>org.drools.persistence.info.SessionInfo</class>
        <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
        <class>org.drools.persistence.info.WorkItemInfo</class>
    </persistence-unit>


    <persistence-unit name="org.jbpm.task">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>
        <mapping-file>META-INF/Taskorm.xml</mapping-file>
  
        <class>org.jbpm.task.Attachment</class>
        <class>org.jbpm.task.Content</class>
        <class>org.jbpm.task.BooleanExpression</class>
        <class>org.jbpm.task.Comment</class>
        <class>org.jbpm.task.Deadline</class>
        <class>org.jbpm.task.Comment</class>
        <class>org.jbpm.task.Deadline</class>
        <class>org.jbpm.task.Delegation</class>
        <class>org.jbpm.task.Escalation</class>
        <class>org.jbpm.task.Group</class>
        <class>org.jbpm.task.I18NText</class>
        <class>org.jbpm.task.Notification</class>
        <class>org.jbpm.task.EmailNotification</class>
        <class>org.jbpm.task.EmailNotificationHeader</class>
        <class>org.jbpm.task.PeopleAssignments</class>
        <class>org.jbpm.task.Reassignment</class>
        <class>org.jbpm.task.Status</class>
        <class>org.jbpm.task.Task</class>
        <class>org.jbpm.task.TaskData</class>
        <class>org.jbpm.task.SubTasksStrategy</class>
        <class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>
        <class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>
        <class>org.jbpm.task.User</class>
    </persistence-unit>
</persistence>


Also I'm using custom TransactionManagerLookup class (it's specifyed in hibernate.properties):

public class TransactionManagerLookup extends JNDITransactionManagerLookup {
    @Override
    protected String getName() {
        return "java:jboss/TransactionManager";
    }
 
 
    @Override
    public String getUserTransactionName() {
        return "java:comp/UserTransaction";
    }
}



I even tried to rebind UserTransaction (which Task service looks up) to BitronixTransactionManager, but it not helps. I checked that there is UserTransaction object which TaskService looks up.

Thank you for your attention. Have a good day!
--------------------------------------------------------------

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

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20121001/61669199/attachment-0001.html 


More information about the jboss-user mailing list