3 Replies Latest reply on Feb 21, 2013 6:17 AM by Feki Ahmed

    org.jbpm.workflow.instance.WorkflowRuntimeException: -- Illegal method call. This session was previously disposed.

    Feki Ahmed Newbie

      Hi,

      i ve a simple java class with a main which i m using such as a test case.

      All what i want to achieve is to get user task's from a loaded session which was previousely started and disposed.

      i ve already seen questions asked about this issue(here:https://community.jboss.org/thread/201901) but still didn't find a solution for it anywhere. it s said that the session is disposed before transaction is completed which cause the mentioned error. and that the dispose must happen after transaction completion but i don't know what are transaction boundaries and how to know when it is completed.

       

       

       

      this is the class with the main :

       

      *************************************************************************************************************************

      package com.salaboy.jbpm5;

       

       

      import bitronix.tm.TransactionManagerServices;

      import bitronix.tm.resource.jdbc.PoolingDataSource;

       

       

       

       

      import com.salaboy.model.Person;

      import java.util.HashMap;

      import java.util.List;

      import java.util.Map;

       

       

      import javax.naming.InitialContext;

      import javax.naming.NamingException;

      import javax.persistence.EntityManagerFactory;

      import javax.persistence.Persistence;

      import javax.transaction.HeuristicMixedException;

      import javax.transaction.HeuristicRollbackException;

      import javax.transaction.NotSupportedException;

      import javax.transaction.RollbackException;

      import javax.transaction.SystemException;

      import javax.transaction.UserTransaction;

       

       

      import org.drools.KnowledgeBase;

      import org.drools.KnowledgeBaseFactory;

      import org.drools.SystemEventListenerFactory;

      import org.drools.builder.KnowledgeBuilder;

      import org.drools.builder.KnowledgeBuilderError;

      import org.drools.builder.KnowledgeBuilderFactory;

      import org.drools.builder.ResourceType;

      import org.drools.impl.EnvironmentFactory;

      import org.drools.io.impl.ClassPathResource;

       

       

      import org.drools.persistence.jpa.JPAKnowledgeService;

      import org.drools.runtime.*;

      import org.drools.runtime.process.ProcessInstance;

       

       

      import org.jbpm.process.workitem.wsht.LocalHTWorkItemHandler;

      import org.jbpm.task.Group;

       

       

      import org.jbpm.task.TaskService;

      import org.jbpm.task.User;

      import org.jbpm.task.query.TaskSummary;

      import org.jbpm.task.service.local.LocalTaskService;

       

       

       

       

       

      public class MytestMain {

       

       

       

                private static PoolingDataSource ds;

       

       

       

                public static void main(String[] args) {

       

       

                              ds = new PoolingDataSource();

       

       

       

       

                        //System.setProperty("java.naming.factory.initial", "bitronix.tm.jndi.BitronixInitialContextFactory");

       

       

                        ds.setUniqueName("jdbc/testDS1");

       

       

                        //NON XA CONFIGS

                        ds.setClassName("org.h2.jdbcx.JdbcDataSource");

                        ds.setMaxPoolSize(3);

                        ds.setAllowLocalTransactions(true);

                        ds.getDriverProperties().put("user", "sa");

                        ds.getDriverProperties().put("password", "sasa");

                        ds.getDriverProperties().put("URL", "jdbc:h2:mem:mydb");

                        //XA CONFIGS

      //                  ds.setClassName("bitronix.tm.resource.jdbc.lrc.LrcXADataSource");

      //                  ds.setMaxPoolSize(3);

      //                  ds.setAllowLocalTransactions(true);

      //                  ds.getDriverProperties().put("user", "sa");

      //                  ds.getDriverProperties().put("password", "sasa");

      //                  ds.getDriverProperties().put("Url", "jdbc:h2:mem:mydb");

      //                  ds.getDriverProperties().put("driverClassName", "org.h2.Driver");

       

                        ds.init();

       

                        /////FIN INITIAISATION

       

       

                        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

                        kbuilder.add(new ClassPathResource("process-async-interactions.bpmn"), ResourceType.BPMN2);

       

       

                        if (kbuilder.hasErrors()) {

                            for (KnowledgeBuilderError error : kbuilder.getErrors()) {

                                System.out.println(">>> Error:" + error.getMessage());

       

       

                            }

                            fail(">>> Knowledge couldn't be parsed! ");

                        }

       

       

                        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();

       

       

                        kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());

                        Environment env = EnvironmentFactory.newEnvironment();

                        EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.runtime.ht");

                        env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);

                        env.set(EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager());

       

       

       

       

       

       

                     // start the transaction

       

       

                        UserTransaction ut = null;

                                    try {

                                              ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );

                                    } catch (NamingException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    }

       

       

                        try {

                                              ut.begin();

                                    } catch (NotSupportedException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (SystemException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    }

       

                        // Let's create a Persistence Knowledge Session

                        System.out.println(" >>> Let's create a Persistent Knowledge Session");

                        final StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);

       

                     // commit the transaction

       

       

                        try {

                                              ut.commit();

                                    } catch (SecurityException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (IllegalStateException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (RollbackException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (HeuristicMixedException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (HeuristicRollbackException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (SystemException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    }

       

                        int sessionId = ksession.getId();

      //                  assertNotNull(sessionId);

      //                  assertTrue(sessionId != 0);

                        // We need to register the WorkItems and Listeners that the session will use

                        TaskService client = createTaskService(emf);

                        LocalHTWorkItemHandler localHTWorkItemHandler = new LocalHTWorkItemHandler(client, ksession);

                        MockExternalServiceWorkItemHandler mockExternalServiceWorkItemHandler = new MockExternalServiceWorkItemHandler();

                        ksession.getWorkItemManager().registerWorkItemHandler("Human Task", localHTWorkItemHandler);

                        ksession.getWorkItemManager().registerWorkItemHandler("External Service Call", mockExternalServiceWorkItemHandler);

                        //KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession);

       

       

       

       

                        // Let's create a Process Instance

                        Person person = new Person("Salaboy", 29);

                        Map<String, Object> params = new HashMap<String, Object>();

                        params.put("person", person);

       

                               // start the transaction

       

       

       

                                    try {

                                              ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );

                                    } catch (NamingException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    }

       

       

                        try {

                                              ut.begin();

                                    } catch (NotSupportedException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (SystemException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    }

       

       

       

       

                        //Each Command will generate an interaction

                        System.out.println(">>> Let's Create Process Instance");

                        ProcessInstance processInstance = ksession.createProcessInstance("com.salaboy.process.AsyncInteractions", params);

                        System.out.println(">>> Let's Start the Process Instance");

       

                        try {

                                              ut.commit();

                                    } catch (SecurityException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (IllegalStateException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (RollbackException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (HeuristicMixedException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (HeuristicRollbackException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (SystemException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    }

       

       

                        try {

                                              ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );

                                    } catch (NamingException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    }

       

       

                        try {

                                              ut.begin();

                                    } catch (NotSupportedException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (SystemException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    }

       

       

       

       

       

                        processInstance = ksession.startProcessInstance(processInstance.getId());

       

                        try {

                                              ut.commit();

                                    } catch (SecurityException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (IllegalStateException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (RollbackException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (HeuristicMixedException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (HeuristicRollbackException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (SystemException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    }

       

       

       

       

                        System.out.println(" >>> Looking for Salaboy's Tasks");

                        List<TaskSummary> salaboysTasks = client.getTasksAssignedAsPotentialOwner("salaboy", "en-UK");

                        //assertTrue(salaboysTasks.size() == 1);

                        System.out.println("salaboysTasks.size() : "+salaboysTasks.size());

       

                        TaskSummary salaboyTask = salaboysTasks.get(0);

                        System.out.println(" >>> Starting Salaboy's Task");

                        client.start(salaboyTask.getId(), "salaboy");

       

       

       

                        System.out.println(" >>> Completing Salaboy's Task");

                        client.complete(salaboyTask.getId(), "salaboy", null);

       

       

                        try {

                                                            ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );

                                                  } catch (NamingException e) {

                                                            // TODO Auto-generated catch block

                                                            e.printStackTrace();

                                                  }

       

       

                                      try {

                                                            ut.begin();

                                                  } catch (NotSupportedException e) {

                                                            // TODO Auto-generated catch block

                                                            e.printStackTrace();

                                                  } catch (SystemException e) {

                                                            // TODO Auto-generated catch block

                                                            e.printStackTrace();

                                                  }

       

       

                        System.out.println(">>> Disposing Session");

                        ksession.dispose();

       

                        try {

                                              ut.commit();

                                    } catch (SecurityException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (IllegalStateException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (RollbackException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (HeuristicMixedException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (HeuristicRollbackException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    } catch (SystemException e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    }

       

       

                     // Let's reload the session

                        StatefulKnowledgeSession loadedKsession = JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId, kbase, null, env);

                        // All the listeners and WorkItemHandlers are volatile, so we need to register them each time that we reload the session

                        //  from the DB.

                        LocalHTWorkItemHandler localHTWorkItemHandler2 = new LocalHTWorkItemHandler(client, ksession);

                        MockExternalServiceWorkItemHandler mockExternalServiceWorkItemHandler2 = new MockExternalServiceWorkItemHandler();

       

                        loadedKsession.getWorkItemManager().registerWorkItemHandler("Human Task", localHTWorkItemHandler2);

                        loadedKsession.getWorkItemManager().registerWorkItemHandler("External Service Call", mockExternalServiceWorkItemHandler2);

       

       

       

       

       

                        List<TaskSummary> adminTasks = client.getTasksAssignedAsPotentialOwner("Administrator", "en-UK");

                        //assertTrue(adminTasks.size() == 1);

                        System.out.println("adminTasks.size() : "+adminTasks.size());

                        TaskSummary adminTask = adminTasks.get(0);

       

                        client.start(adminTask.getId(), "Administrator");

       

                        client.complete(adminTask.getId(), "Administrator", null);

       

       

                        processInstance = ksession.getProcessInstance(processInstance.getId());

                        //The process instance was completed and it should be out of the Ksession.

                        //assertNull(processInstance);

                        if(processInstance==null)

                        System.out.println("processInstance is null ");

       

       

       

       

       

       

                }

       

                private static TaskService createTaskService(EntityManagerFactory emf) {

              org.jbpm.task.service.TaskService taskService = new org.jbpm.task.service.TaskService(emf, SystemEventListenerFactory.getSystemEventListener());

              Map<String, User> users = new HashMap<String, User>();

              users.put("salaboy", new User("salaboy"));

              users.put("Administrator", new User("Administrator"));

       

       

              Map<String, Group> groups = new HashMap<String, Group>();

              taskService.addUsersAndGroups(users, groups);

              TaskService client = new LocalTaskService(taskService);

       

       

              return client;

          }

       

       

       

       

       

       

       

       

      }

       

      *************************************************************************************************************************

       

      and this is the log :

       

      log4j:WARN No appenders could be found for logger (bitronix.tm.resource.jdbc.PoolingDataSource).

      log4j:WARN Please initialize the log4j system properly.

      log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

      >>> Let's create a Persistent Knowledge Session

      Hibernate: insert into SessionInfo (id, lastModificationDate, rulesByteArray, startDate, OPTLOCK) values (null, ?, ?, ?, ?)

      Hibernate: select task0_.id as col_0_0_, deadline1_.id as col_1_0_, deadline1_.deadline_date as col_2_0_ from Task task0_, Deadline deadline1_ where task0_.archived=0 and (deadline1_.id in (select startdeadl2_.id from Deadline startdeadl2_ where task0_.id=startdeadl2_.Deadlines_StartDeadLine_Id) or deadline1_.id in (select enddeadlin3_.id from Deadline enddeadlin3_ where task0_.id=enddeadlin3_.Deadlines_EndDeadLine_Id)) and deadline1_.escalated=0 order by deadline1_.deadline_date

      Hibernate: select user0_.id as id8_0_ from OrganizationalEntity user0_ where user0_.id=? and user0_.DTYPE='User'

      Hibernate: insert into OrganizationalEntity (DTYPE, id) values ('User', ?)

      Hibernate: select user0_.id as id8_0_ from OrganizationalEntity user0_ where user0_.id=? and user0_.DTYPE='User'

      Hibernate: insert into OrganizationalEntity (DTYPE, id) values ('User', ?)

      >>> Let's Create Process Instance

      Hibernate: insert into ProcessInstanceInfo (InstanceId, OPTLOCK, processId, startDate, lastReadDate, lastModificationDate, state, processInstanceByteArray) values (null, ?, ?, ?, ?, ?, ?, ?)

      >>> Let's Start the Process Instance

      Hibernate: update SessionInfo set lastModificationDate=?, rulesByteArray=?, startDate=?, OPTLOCK=? where id=? and OPTLOCK=?

      Hibernate: update ProcessInstanceInfo set OPTLOCK=?, processId=?, startDate=?, lastReadDate=?, lastModificationDate=?, state=?, processInstanceByteArray=? where InstanceId=? and OPTLOCK=?

      Hibernate: select processins0_.InstanceId as InstanceId0_0_, processins0_.OPTLOCK as OPTLOCK0_0_, processins0_.processId as processId0_0_, processins0_.startDate as startDate0_0_, processins0_.lastReadDate as lastRead5_0_0_, processins0_.lastModificationDate as lastModi6_0_0_, processins0_.state as state0_0_, processins0_.processInstanceByteArray as processI8_0_0_ from ProcessInstanceInfo processins0_ where processins0_.InstanceId=?

      Hibernate: insert into WorkItemInfo (workItemId, creationDate, name, processInstanceId, state, OPTLOCK, workItemByteArray) values (null, ?, ?, ?, ?, ?, ?)

      Hibernate: select user_.id from OrganizationalEntity user_ where user_.id=?

      Hibernate: insert into Task (id, archived, allowedToDelegate, taskInitiator_id, priority, activationTime, actualOwner_id, completedOn, createdBy_id, createdOn, documentAccessType, documentContentId, documentType, expirationTime, faultAccessType, faultContentId, faultName, faultType, outputAccessType, outputContentId, outputType, parentId, previousStatus, processId, processInstanceId, processSessionId, skipable, status, workItemId, OPTLOCK) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

      Hibernate: insert into I18NText (id, language, shortText, text) values (null, ?, ?, ?)

      Hibernate: insert into I18NText (id, language, shortText, text) values (null, ?, ?, ?)

      Hibernate: insert into Content (id, content) values (null, ?)

      Hibernate: update SessionInfo set lastModificationDate=?, rulesByteArray=?, startDate=?, OPTLOCK=? where id=? and OPTLOCK=?

      Hibernate: select eventtypes0_.InstanceId as InstanceId0_, eventtypes0_.element as element0_ from EventTypes eventtypes0_ where eventtypes0_.InstanceId=?

      Hibernate: update ProcessInstanceInfo set OPTLOCK=?, processId=?, startDate=?, lastReadDate=?, lastModificationDate=?, state=?, processInstanceByteArray=? where InstanceId=? and OPTLOCK=?

      Hibernate: update WorkItemInfo set creationDate=?, name=?, processInstanceId=?, state=?, OPTLOCK=?, workItemByteArray=? where workItemId=? and OPTLOCK=?

      Hibernate: update Task set archived=?, allowedToDelegate=?, taskInitiator_id=?, priority=?, activationTime=?, actualOwner_id=?, completedOn=?, createdBy_id=?, createdOn=?, documentAccessType=?, documentContentId=?, documentType=?, expirationTime=?, faultAccessType=?, faultContentId=?, faultName=?, faultType=?, outputAccessType=?, outputContentId=?, outputType=?, parentId=?, previousStatus=?, processId=?, processInstanceId=?, processSessionId=?, skipable=?, status=?, workItemId=?, OPTLOCK=? where id=? and OPTLOCK=?

      Hibernate: update I18NText set Task_Descriptions_Id=? where id=?

      Hibernate: insert into PeopleAssignments_BAs (task_id, entity_id) values (?, ?)

      Hibernate: insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?)

      Hibernate: update I18NText set Task_Subjects_Id=? where id=?

      >>> Looking for Salaboy's Tasks

      Hibernate: select task0_.id as col_0_0_, task0_.processInstanceId as col_1_0_, names5_.text as col_2_0_, subjects3_.text as col_3_0_, descriptio4_.text as col_4_0_, task0_.status as col_5_0_, task0_.priority as col_6_0_, task0_.skipable as col_7_0_, user2_.id as col_8_0_, user1_.id as col_9_0_, task0_.createdOn as col_10_0_, task0_.activationTime as col_11_0_, task0_.expirationTime as col_12_0_, task0_.processId as col_13_0_, task0_.processSessionId as col_14_0_ from Task task0_ left outer join OrganizationalEntity user1_ on task0_.createdBy_id=user1_.id left outer join OrganizationalEntity user2_ on task0_.actualOwner_id=user2_.id left outer join I18NText subjects3_ on task0_.id=subjects3_.Task_Subjects_Id left outer join I18NText descriptio4_ on task0_.id=descriptio4_.Task_Descriptions_Id left outer join I18NText names5_ on task0_.id=names5_.Task_Names_Id, OrganizationalEntity organizati6_ where task0_.archived=0 and (organizati6_.id=? or organizati6_.id in (?)) and (organizati6_.id in (select potentialo7_.entity_id from PeopleAssignments_PotOwners potentialo7_ where task0_.id=potentialo7_.task_id)) and (names5_.language=? or (select count(names8_.Task_Names_Id) from I18NText names8_ where task0_.id=names8_.Task_Names_Id)=0) and (subjects3_.language=? or (select count(subjects9_.Task_Subjects_Id) from I18NText subjects9_ where task0_.id=subjects9_.Task_Subjects_Id)=0) and (descriptio4_.language=? or (select count(descriptio10_.Task_Descriptions_Id) from I18NText descriptio10_ where task0_.id=descriptio10_.Task_Descriptions_Id)=0) and (task0_.status in ('Created' , 'Ready' , 'Reserved' , 'InProgress' , 'Suspended')) and (task0_.expirationTime is null)

      Exception in thread "main" java.lang.IllegalStateException: Illegal method call. This session was previously disposed.

                at org.drools.reteoo.DisposedReteooWorkingMemory.getWorkItemManager(DisposedReteooWorkingMemory.java:386)

                at org.drools.impl.StatefulKnowledgeSessionImpl.getWorkItemManager(StatefulKnowledgeSessionImpl.java:311)

                at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:69)

                at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:32)Hibernate: select user0_.id as id8_0_ from OrganizationalEntity user0_ where user0_.id=? and user0_.DTYPE='User'

      salaboysTasks.size() : 1

      >>> Starting Salaboy's Task

      Hibernate: update Task set archived=?, allowedToDelegate=?, taskInitiator_id=?, priority=?, activationTime=?, actualOwner_id=?, completedOn=?, createdBy_id=?, createdOn=?, documentAccessType=?, documentContentId=?, documentType=?, expirationTime=?, faultAccessType=?, faultContentId=?, faultName=?, faultType=?, outputAccessType=?, outputContentId=?, outputType=?, parentId=?, previousStatus=?, processId=?, processInstanceId=?, processSessionId=?, skipable=?, status=?, workItemId=?, OPTLOCK=? where id=? and OPTLOCK=?

      >>> Completing Salaboy's Task

      Hibernate: update Task set archived=?, allowedToDelegate=?, taskInitiator_id=?, priority=?, activationTime=?, actualOwner_id=?, completedOn=?, createdBy_id=?, createdOn=?, documentAccessType=?, documentContentId=?, documentType=?, expirationTime=?, faultAccessType=?, faultContentId=?, faultName=?, faultType=?, outputAccessType=?, outputContentId=?, outputType=?, parentId=?, previousStatus=?, processId=?, processInstanceId=?, processSessionId=?, skipable=?, status=?, workItemId=?, OPTLOCK=? where id=? and OPTLOCK=?

      Hibernate: select workitemin0_.workItemId as workItemId16_0_, workitemin0_.creationDate as creation2_16_0_, workitemin0_.name as name16_0_, workitemin0_.processInstanceId as processI4_16_0_, workitemin0_.state as state16_0_, workitemin0_.OPTLOCK as OPTLOCK16_0_, workitemin0_.workItemByteArray as workItem7_16_0_ from WorkItemInfo workitemin0_ where workitemin0_.workItemId=?

      Hibernate: select processins0_.InstanceId as InstanceId0_0_, processins0_.OPTLOCK as OPTLOCK0_0_, processins0_.processId as processId0_0_, processins0_.startDate as startDate0_0_, processins0_.lastReadDate as lastRead5_0_0_, processins0_.lastModificationDate as lastModi6_0_0_, processins0_.state as state0_0_, processins0_.processInstanceByteArray as processI8_0_0_ from ProcessInstanceInfo processins0_ where processins0_.InstanceId=?

      Hibernate: insert into WorkItemInfo (workItemId, creationDate, name, processInstanceId, state, OPTLOCK, workItemByteArray) values (null, ?, ?, ?, ?, ?, ?)

      >>> Completing an External Interaction

      Hibernate: insert into WorkItemInfo (workItemId, creationDate, name, processInstanceId, state, OPTLOCK, workItemByteArray) values (null, ?, ?, ?, ?, ?, ?)

      Hibernate: select user_.id from OrganizationalEntity user_ where user_.id=?

      Hibernate: insert into Task (id, archived, allowedToDelegate, taskInitiator_id, priority, activationTime, actualOwner_id, completedOn, createdBy_id, createdOn, documentAccessType, documentContentId, documentType, expirationTime, faultAccessType, faultContentId, faultName, faultType, outputAccessType, outputContentId, outputType, parentId, previousStatus, processId, processInstanceId, processSessionId, skipable, status, workItemId, OPTLOCK) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

      Hibernate: insert into I18NText (id, language, shortText, text) values (null, ?, ?, ?)

      Hibernate: insert into I18NText (id, language, shortText, text) values (null, ?, ?, ?)

      Hibernate: insert into Content (id, content) values (null, ?)

      Hibernate: select eventtypes0_.InstanceId as InstanceId0_, eventtypes0_.element as element0_ from EventTypes eventtypes0_ where eventtypes0_.InstanceId=?

      Hibernate: update ProcessInstanceInfo set OPTLOCK=?, processId=?, startDate=?, lastReadDate=?, lastModificationDate=?, state=?, processInstanceByteArray=? where InstanceId=? and OPTLOCK=?

      Hibernate: update WorkItemInfo set creationDate=?, name=?, processInstanceId=?, state=?, OPTLOCK=?, workItemByteArray=? where workItemId=? and OPTLOCK=?

      Hibernate: insert into EventTypes (InstanceId, element) values (?, ?)

      Hibernate: delete from WorkItemInfo where workItemId=? and OPTLOCK=?

      Hibernate: delete from WorkItemInfo where workItemId=? and OPTLOCK=?

      Hibernate: update Task set archived=?, allowedToDelegate=?, taskInitiator_id=?, priority=?, activationTime=?, actualOwner_id=?, completedOn=?, createdBy_id=?, createdOn=?, documentAccessType=?, documentContentId=?, documentType=?, expirationTime=?, faultAccessType=?, faultContentId=?, faultName=?, faultType=?, outputAccessType=?, outputContentId=?, outputType=?, parentId=?, previousStatus=?, processId=?, processInstanceId=?, processSessionId=?, skipable=?, status=?, workItemId=?, OPTLOCK=? where id=? and OPTLOCK=?

      Hibernate: update I18NText set Task_Descriptions_Id=? where id=?

      Hibernate: insert into PeopleAssignments_BAs (task_id, entity_id) values (?, ?)

      Hibernate: insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?)

      Hibernate: update I18NText set Task_Subjects_Id=? where id=?

      >>> Disposing Session

      Hibernate: select sessioninf0_.id as id15_0_, sessioninf0_.lastModificationDate as lastModi2_15_0_, sessioninf0_.rulesByteArray as rulesByt3_15_0_, sessioninf0_.startDate as startDate15_0_, sessioninf0_.OPTLOCK as OPTLOCK15_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?

      Hibernate: select task0_.id as col_0_0_, task0_.processInstanceId as col_1_0_, names5_.text as col_2_0_, subjects3_.text as col_3_0_, descriptio4_.text as col_4_0_, task0_.status as col_5_0_, task0_.priority as col_6_0_, task0_.skipable as col_7_0_, user2_.id as col_8_0_, user1_.id as col_9_0_, task0_.createdOn as col_10_0_, task0_.activationTime as col_11_0_, task0_.expirationTime as col_12_0_, task0_.processId as col_13_0_, task0_.processSessionId as col_14_0_ from Task task0_ left outer join OrganizationalEntity user1_ on task0_.createdBy_id=user1_.id left outer join OrganizationalEntity user2_ on task0_.actualOwner_id=user2_.id left outer join I18NText subjects3_ on task0_.id=subjects3_.Task_Subjects_Id left outer join I18NText descriptio4_ on task0_.id=descriptio4_.Task_Descriptions_Id left outer join I18NText names5_ on task0_.id=names5_.Task_Names_Id, OrganizationalEntity organizati6_ where task0_.archived=0 and (organizati6_.id=? or organizati6_.id in (?)) and (organizati6_.id in (select potentialo7_.entity_id from PeopleAssignments_PotOwners potentialo7_ where task0_.id=potentialo7_.task_id)) and (names5_.language=? or (select count(names8_.Task_Names_Id) from I18NText names8_ where task0_.id=names8_.Task_Names_Id)=0) and (subjects3_.language=? or (select count(subjects9_.Task_Subjects_Id) from I18NText subjects9_ where task0_.id=subjects9_.Task_Subjects_Id)=0) and (descriptio4_.language=? or (select count(descriptio10_.Task_Descriptions_Id) from I18NText descriptio10_ where task0_.id=descriptio10_.Task_Descriptions_Id)=0) and (task0_.status in ('Created' , 'Ready' , 'Reserved' , 'InProgress' , 'Suspended')) and (task0_.expirationTime is null)

      Hibernate: select user0_.id as id8_0_ from OrganizationalEntity user0_ where user0_.id=? and user0_.DTYPE='User'

      adminTasks.size() : 1

      Hibernate: update Task set archived=?, allowedToDelegate=?, taskInitiator_id=?, priority=?, activationTime=?, actualOwner_id=?, completedOn=?, createdBy_id=?, createdOn=?, documentAccessType=?, documentContentId=?, documentType=?, expirationTime=?, faultAccessType=?, faultContentId=?, faultName=?, faultType=?, outputAccessType=?, outputContentId=?, outputType=?, parentId=?, previousStatus=?, processId=?, processInstanceId=?, processSessionId=?, skipable=?, status=?, workItemId=?, OPTLOCK=? where id=? and OPTLOCK=?

      Hibernate: update Task set archived=?, allowedToDelegate=?, taskInitiator_id=?, priority=?, activationTime=?, actualOwner_id=?, completedOn=?, createdBy_id=?, createdOn=?, documentAccessType=?, documentContentId=?, documentType=?, expirationTime=?, faultAccessType=?, faultContentId=?, faultName=?, faultType=?, outputAccessType=?, outputContentId=?, outputType=?, parentId=?, previousStatus=?, processId=?, processInstanceId=?, processSessionId=?, skipable=?, status=?, workItemId=?, OPTLOCK=? where id=? and OPTLOCK=?

       

       

                at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)

                at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:373)

                at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150)

                at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.handleCompletedTask(GenericHTWorkItemHandler.java:273)

                at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.execute(GenericHTWorkItemHandler.java:234)

                at org.jbpm.task.service.local.LocalTaskService$SimpleEventTransport.trigger(LocalTaskService.java:329)

                at org.jbpm.task.event.MessagingTaskEventListener.triggerPayload(MessagingTaskEventListener.java:76)

                at org.jbpm.task.event.MessagingTaskEventListener.handleEvent(MessagingTaskEventListener.java:92)

                at org.jbpm.task.event.MessagingTaskEventListener.taskCompleted(MessagingTaskEventListener.java:109)

                at org.jbpm.task.event.TaskEventSupport.fireTaskCompleted(TaskEventSupport.java:49)

                at org.jbpm.task.service.TaskServiceSession.postTaskCompleteOperation(TaskServiceSession.java:569)

                at org.jbpm.task.service.TaskServiceSession.taskOperation(TaskServiceSession.java:495)

                at org.jbpm.task.service.local.LocalTaskService.complete(LocalTaskService.java:83)

                at com.salaboy.jbpm5.MytestMain.main(MytestMain.java:360)

       

       

      i need your help please !!