1 2 Previous Next 20 Replies Latest reply on Aug 6, 2012 4:43 AM by salaboy21

    My jBPM5.2 doesn't work! Like this......

    c1269355458

      hi, all.

      JPA and MinaTaskServer are working well.

       

      my action is like this:


      StatefulKnowledgeSession session = null;


      try {


      session = JbpmAPIUtil.createKnowledgeSession("bpmn/HumanTask.bpmn");


      session.getWorkItemManager().registerWorkItemHandler("Human Task", new WSHumanTaskHandler());


      } catch (Exception e) {


      e.printStackTrace();


      }


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


      params.put("userId", "krisv");


      params.put("description", "Need a new laptop computer");


      ProcessInstance instance = session.startProcess("com.sample.humantask", params);





      System.out.println("\n\n start " + instance);



       

      and error:

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

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

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

      2012-03-22 14:54:49,546 INFO  [LoggingFilter.java:158] : CREATED

      2012-03-22 14:54:49,546 INFO  [LoggingFilter.java:158] : OPENED

      2012-03-22 14:54:49,562 INFO  [LoggingFilter.java:140] : RECEIVED: HeapBuffer[pos=0 lim=675 cap=2048: 00 00 01 4F AC ED 00 05 73 72 01 00 1D 6F 72 67...]

      2012-03-22 14:54:49,734 INFO  [LoggingFilter.java:140] : RECEIVED: HeapBuffer[pos=0 lim=1007 cap=2048: 00 00 01 4D AC ED 00 05 73 72 01 00 1D 6F 72 67...]

      2012-03-22 14:54:49,750 WARN  [JDBCExceptionReporter.java:233] : SQL Error: 1452, SQLState: 23000

      2012-03-22 14:54:49,750 ERROR [JDBCExceptionReporter.java:234] : Cannot add or update a child row: a foreign key constraint fails (`example`.`peopleassignments_potowners`, CONSTRAINT `FK1EE418D2C122ED2` FOREIGN KEY (`entity_id`) REFERENCES `organizationalentity` (`id`))

      javax.persistence.RollbackException: Error while committing the transaction

       

      ....

      Caused by: java.sql.BatchUpdateException: Cannot add or update a child row: a foreign key constraint fails (`example`.`peopleassignments_potowners`, CONSTRAINT `FK1EE418D2C122ED2` FOREIGN KEY (`entity_id`) REFERENCES `organizationalentity` (`id`))

      ....

       

      thinks.

        • 1. Re: My jBPM5.2 doesn't work! Like this......
          salaboy21

          Make sure that you have the Administrator user inside your Human Task user table. By the way, what is "example", make sure that you have an user called that as well if you want to asign something to it.

          Cheers

          • 2. Re: My jBPM5.2 doesn't work! Like this......
            c1269355458

            Thanks.

             

            Thear is a row in the table like this:

            DTYPE ID

            User    administrator

            • 3. Re: My jBPM5.2 doesn't work! Like this......
              salaboy21

              I think it should be "Administrator", what about "example"??

              Cheers

              • 4. Re: My jBPM5.2 doesn't work! Like this......
                c1269355458

                "example" is the Database'name.

                I have change "administrator" to "Administrator", but it doesn't work always!

                Cheers

                • 5. Re: My jBPM5.2 doesn't work! Like this......
                  salaboy21

                  Did you check that all the users that are trying to be assigned exists in the database?

                  Please confirm.

                  • 6. Re: My jBPM5.2 doesn't work! Like this......
                    c1269355458

                    I promiss it.

                     

                    I have added all the users when MinaTaskServer class started.

                     

                    TaskService taskService = new TaskService(emfTask, SystemEventListenerFactory.getSystemEventListener());

                                                  /*

                                                   * Add the required users

                                                   */

                                                  TaskServiceSession taskSession = taskService.createSession();

                                                  taskSession.addUser(new User("Administrator"));

                                                  taskSession.addGroup(new Group("Stuff"));

                                                  taskSession.addUser(new User("kvsi"));

                                                  taskSession.addGroup(new Group("Manager"));

                                                  taskSession.addUser(new User("john"));

                                                  taskSession.addUser(new User("krisv"));

                                                  /* Start Mina server for HT */

                                                  MinaTaskServer server = new MinaTaskServer(taskService);

                                                  Thread thread = new Thread(server);

                                                  thread.start();

                    • 7. Re: My jBPM5.2 doesn't work! Like this......
                      c1269355458

                      All users is exists in the database.

                       

                      thinks.

                      • 8. Re: My jBPM5.2 doesn't work! Like this......
                        salaboy21

                        Can you show us please how are you doing the assignments?

                        Cheers

                        • 9. Re: My jBPM5.2 doesn't work! Like this......
                          c1269355458

                          servlet listener:

                           




                          EntityManagerFactory emfTask = Persistence.createEntityManagerFactory("org.jbpm.task");



                          // (EntityManagerFactory) Constants.ctx



                          // .getBean("entityManagerFactory");



                          TaskService taskService = new TaskService(emfTask, SystemEventListenerFactory.getSystemEventListener());



                          /*



                          * Add the required users



                          */



                          TaskServiceSession taskSession = taskService.createSession();



                          taskSession.addUser(new User("Administrator"));



                          taskSession.addGroup(new Group("Stuff"));



                          taskSession.addUser(new User("kvsi"));



                          taskSession.addGroup(new Group("Manager"));



                          taskSession.addUser(new User("john"));



                          taskSession.addUser(new User("krisv"));



                          /* Start Mina server for HT */



                          MinaTaskServer server = new MinaTaskServer(taskService);



                          Thread thread = new Thread(server);



                          thread.start();



                          System.out.println("Server started ...");

                           

                           

                          struts Action

                           

                            StatefulKnowledgeSession session = null;

                                              try {

                                                        session = JbpmAPIUtil.createKnowledgeSession("bpmn/apply-leave.bpmn");

                                                        session.getWorkItemManager().registerWorkItemHandler("Human Task", new WSHumanTaskHandler());

                                              } catch (Exception e) {

                                                        e.printStackTrace();

                                              }

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

                                              params.put("manager", "john");

                                              ProcessInstance instance = session.startProcess("bpmn.applyLeave",params);

                                              System.out.println(" \n\n process start : " + instance);

                           

                          the other action:

                           

                          List<TaskSummary> tasks = JbpmAPIUtil.getTasksAssignedAsPotentialOwner("john");

                                              System.out.println(" size of tasks " + tasks.size());

                                              for (TaskSummary ts : tasks) {

                                                        System.out.println("\n\n  ts :  " + ts);

                                              }

                           

                          bpmn:

                          actorId : #{manager}

                           

                          thanks very much!

                          • 10. Re: My jBPM5.2 doesn't work! Like this......
                            salaboy21

                            Is "manager" defined as a process variable?

                            Cheers

                            • 11. Re: My jBPM5.2 doesn't work! Like this......
                              c1269355458

                              Yes.

                               

                              Cheers

                              • 12. Re: My jBPM5.2 doesn't work! Like this......
                                c1269355458

                                2012-03-22 18:00:05,078 ERROR [JDBCExceptionReporter.java:234] : Cannot add or update a child row: a foreign key constraint fails (`example`.`task`, CONSTRAINT `FK27A9A59E619A0` FOREIGN KEY (`createdBy_id`) REFERENCES `organizationalentity` (`id`))

                                • 13. Re: My jBPM5.2 doesn't work! Like this......
                                  salaboy21

                                  I notice that you are starting two different processes:

                                  ProcessInstance instance = session.startProcess("bpmn.applyLeave",params);

                                  and

                                  ProcessInstance instance = session.startProcess("com.sample.humantask", params);

                                   

                                  Which one is the failing one?

                                  It's impossible to help if we don't have accuarate data to look at. Can you please create an isolated test that shows the problem and share the maven project to run it?

                                  Cheers

                                  • 14. Re: My jBPM5.2 doesn't work! Like this......
                                    salaboy21

                                    Now you are posting different errors as well

                                    1 2 Previous Next