3 Replies Latest reply on Oct 26, 2012 10:00 AM by joploya

    Human task + HornetQ + persistence + MySQL => ununderstanding stacktrace

    joploya Newbie

      Hello... or welcome back,

       

      I go from error to error with jbpm and Human task, trying using them in my web application.

       

      Last step was to connect the human task to LDAP and it seems working well :

       

      16:30:13,329 INFO  [stdout] (MSC service thread 1-6) HornetQ Task service started correctly !
      16:30:13,330 INFO  [stdout] (MSC service thread 1-6) HornetQ Task service running ... 
      16:30:13,334 INFO  [org.jbpm.task.service.UserGroupCallbackManager] (MSC service thread 1-6) UserGroupCallback registered: org.jbpm.task.service.LDAPUserGroupCallbackImpl
      16:30:13,335 INFO  [stdout] (MSC service thread 1-6) Task service startup completed successfully !
      

       

      So I return to the web app where I created a classe to manage the knowledgeSession (file attach), that I use in my Bean :

       

                               try {
                                    KnowledgeBase kbase = readKnowledgeBase();
                                    StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
                                      KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession, "/log/loggerFile.log", 1000);
                                      HornetQHTWorkItemHandler hornetQHTWorkItemHandler = new HornetQHTWorkItemHandler(ksession);
                                      ksession.getWorkItemManager().registerWorkItemHandler("Human Task", hornetQHTWorkItemHandler);
                  
                                      getFlowEntity().setCurrentGroup("AMS_CRW_"+getFlowEntity().getGlobalEntity().getCodifType()+"_CODIF");
                                    getFlowEntity().setRequestorName(((UserLDAP)identity.getUser()).getUser().getFirstName()+" "+((UserLDAP)identity.getUser()).getUser().getName());
                                    //Add the current actor in CC
                                    System.out.println("Add the current actor in CC");
                                    PeopleEntity requestor = getCurrentPeople("AMS_CRW_PM_PL");
                                    listCCnpl.add(requestor);
                                    
                                      // ... some code
      
      
                                    // start a new process instance
                                      Map<String, Object> params = new HashMap<String, Object>();
                                    params.put("userId", requestor.getName());
                                    params.put("userGroup", requestor.getRole());
                                    params.put("flowId", getFlowEntity().getFlowId());
        
                                    ProcessInstance process = ksession.startProcess("com.st.ams.flow.npl", params);
                                    System.out.println("process = "+process.getProcessId()+" : "+process.getProcessName()+" : state("+process.getState()+")");
                                    SystemEventListenerFactory.setSystemEventListener(new SystemEventListener());
        
                                    //Now the PM_PL process his task (it is already complete in reality)
                                    BlockingTaskSummaryResponseHandler taskSummaryResponseHandler = new BlockingTaskSummaryResponseHandler();
                                    List<String> groups = new ArrayList<String>();
                                    groups.add(requestor.getRole());
      
                                    System.out.println("Groups : ");
                                    for(String grp : groups){
                                              System.out.println(" - "+grp);
                                    }
      
                                    amsKnowledgeSession.getClient().getTasksAssignedAsPotentialOwner(requestor.getName(), groups, "en-UK", taskSummaryResponseHandler);
                                    List<TaskSummary> potentialTasks = taskSummaryResponseHandler.getResults();
      
                                    for(TaskSummary task : potentialTasks){
                                              System.out.println("PM_PL can execute task " + task.getName() + "(" + task.getId() + ": " + task.getDescription() + ")");
                                    }
        
                          } catch (Exception e) {
                                    e.printStackTrace();
                          }
      
      
      

       

      The process seams to be launched correctly but after there is a lot of error in many threads (103, 106, 137 ....)

       

      what do they mean?

      Most of the entity mapped by the Human task have a field id, so what can be wrong with persistence? And which persistence?(human-core, human task, or other...)

       

      Thanks in advance to help me progress because the others thread of dicussion and documentation don't help me at this point.

       

      Another question linked is why human task generate a lot of tables like xxx_id_seq whereas entities have an AutoGenerated id value?

       

      Regards,

        • 1. Re: Human task + HornetQ + persistence + MySQL => ununderstanding stacktrace
          joploya Newbie

          After searching, I found that the main problem comes from the GeneratorId of Task.

           

          @Entity

          public class Task implements Externalizable {

               @Id

               @GeneratedValue(strategy = GenerationType.AUTO)

               private long id;


          The AUTO GenerationType let MySQL choose how to implements the id generation. But the created table have no autoIncrement option and no default value.

           

          If I add manually a defaut value I obtain an error like

          Caused by: org.hibernate.HibernateException: The database returned no natively generated identity value

          If I check manually the option "Auto increment" in MySQL I obtain the same error as my first post

          WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (Thread-106) SQL Error: 1364, SQLState: HY000

          ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (Thread-106) Field 'id' doesn't have a default value

           

          How can I make the mapping work without change the GenerationType to IDENTITY?

          Should I change the Taskorm.xml like for jbpm-console?

           

          Thanks to help.

          1 of 1 people found this helpful
          • 2. Re: Human task + HornetQ + persistence + MySQL => ununderstanding stacktrace
            joploya Newbie

            I add these lines after all named-queries to Taskorm.xml of human-task-core/META-INF/

             

                 <entity class="org.jbpm.task.Task" metadata-complete="false">

                       <attributes>

                        <id name="id">

                            <column name="id" />

                            <generated-value strategy="IDENTITY "/>

                                                    </id>

                      </attributes>

                  </entity>

             

            After deployement my table task in MySQL have the option 'Auto Increment' check as I wanted but the error 'field id doesn't have default value' appears again :

             

            14:31:34,615 ERROR [org.jbpm.task.service.TaskServerHandler] (Thread-70) Operation failed: java.lang.RuntimeException: Operation failed

                      at org.jbpm.task.service.TaskServiceSession.doOperationInTransaction(TaskServiceSession.java:994) [jbpm-human-task-core-5.3.0.Final.jar:5.3.0.Final]

                      at org.jbpm.task.service.TaskServiceSession.addTask(TaskServiceSession.java:186) [jbpm-human-task-core-5.3.0.Final.jar:5.3.0.Final]

                      at org.jbpm.task.service.TaskServerHandler.messageReceived(TaskServerHandler.java:144) [jbpm-human-task-core-5.3.0.Final.jar:5.3.0.Final]

                      at org.jbpm.task.service.hornetq.HornetQTaskServerHandler.messageReceived(HornetQTaskServerHandler.java:44) [jbpm-human-task-hornetq-5.3.0.Final.jar:5.3.0.Final]

                      at org.jbpm.task.service.hornetq.BaseHornetQTaskServer.run(BaseHornetQTaskServer.java:85) [jbpm-human-task-hornetq-5.3.0.Final.jar:5.3.0.Final]

                      at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]

            Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Field 'id' doesn't have a default value

                      at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1361) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1295) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:859) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

                      at org.jbpm.task.service.persistence.TaskPersistenceManager.saveEntity(TaskPersistenceManager.java:186) [jbpm-human-task-core-5.3.0.Final.jar:5.3.0.Final]

                      at org.jbpm.task.service.TaskServiceSession$1.doOperation(TaskServiceSession.java:188) [jbpm-human-task-core-5.3.0.Final.jar:5.3.0.Final]

                      at org.jbpm.task.service.TaskServiceSession.doOperationInTransaction(TaskServiceSession.java:979) [jbpm-human-task-core-5.3.0.Final.jar:5.3.0.Final]

                      ... 5 more

            Caused by: org.hibernate.exception.GenericJDBCException: Field 'id' doesn't have a default value

                      at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:52) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at $Proxy38.executeUpdate(Unknown Source)          at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:96) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:55) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2757) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3268) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:78) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:272) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:304) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:195) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:128) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:78) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:208) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:151) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:717) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:710) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.engine.spi.EJB3CascadingAction$1.cascade(EJB3CascadingAction.java:49) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:380) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:323) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:208) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.engine.internal.Cascade.cascadeCollectionElements(Cascade.java:409) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.engine.internal.Cascade.cascadeCollection(Cascade.java:350) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:326) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:208) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:165) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.event.internal.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:462) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:337) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:195) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:128) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:78) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:208) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:151) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:78) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:725) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:701) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:705) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:853) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

                      ... 8 more

            Caused by: java.sql.SQLException: Field 'id' doesn't have a default value

                      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)

                      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)

                      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)

                      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002)

                      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)

                      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624)

                      at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127)

                      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2427)

                      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2345)

                      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2330)

                      at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:493)

                      at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source) [:1.7.0_07]

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_07]

                      at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_07]

                      at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                      ... 45 more

             

             

            14:31:34,654 ERROR [org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler] (http--127.0.0.1-8080-3) Fri Oct 26 14:31:34 CEST 2012: Error when creating task on task server for work item id 1. Error reported by task server: Command AddTaskRequest faild due to Operation failed. Please contact task server administrator.: java.lang.RuntimeException: Command AddTaskRequest faild due to Operation failed. Please contact task server administrator.

                      at org.jbpm.task.service.TaskServerHandler.messageReceived(TaskServerHandler.java:662) [jbpm-human-task-core-5.3.0.Final.jar:5.3.0.Final]

                      at org.jbpm.task.service.hornetq.HornetQTaskServerHandler.messageReceived(HornetQTaskServerHandler.java:44) [jbpm-human-task-hornetq-5.3.0.Final.jar:5.3.0.Final]

                      at org.jbpm.task.service.hornetq.BaseHornetQTaskServer.run(BaseHornetQTaskServer.java:85) [jbpm-human-task-hornetq-5.3.0.Final.jar:5.3.0.Final]

                      at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]

             

            • 3. Re: Human task + HornetQ + persistence + MySQL => ununderstanding stacktrace
              joploya Newbie

              whew, it works at least! I success to save my first task with the correct potowner.

               

              I think other change will be needed to Taskorm.xml, but for the moment I just add :

                        <entity class="org.jbpm.task.Task" metadata-complete="false">

                         <attributes>

                          <id name="id">

                              <column name="id" />

                              <generated-value strategy="IDENTITY "/>

                            </id>

                        </attributes>

                         </entity>

                               <entity class="org.jbpm.task.I18NText" metadata-complete="false">

                         <attributes>

                          <id name="id">

                              <column name="id" />

                              <generated-value strategy="IDENTITY "/>

                             </id>

                        </attributes>

                      </entity>

                               <entity class="org.jbpm.task.Content" metadata-complete="false">

                         <attributes>

                          <id name="id">

                              <column name="id" />

                              <generated-value strategy="IDENTITY "/>

                            </id>

                        </attributes>

                    </entity>

              after named-queries and change the entity mapping tag for jpa2:

              <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"

                             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd"

                             version="2.0">

               

               

              See you next configuration problem.

              Regards,