5 Replies Latest reply on Aug 3, 2009 12:11 PM by benitojuarez

    jbpm beginner questions

    benitojuarez

      Hello,


      i'm just starting with jbpm and got some sticky questions:


      This method starts a new process instance.




      @CreateProcess(definition="supply")
          public void initSupplyProcess()
          {
              statusMessages.add("initSupplyProcess");
          }





      I think it works, because a db entry is created. But how can i get a handle on it? Is the new created instance somewhere in the contexts?


      second: i tried the example from the seam documentation. there is a list pooledTaskInstanceList used (presumably a datamodel from a seam bean). In my case the list is empty even after i created the process instance. Is there some config required?



      thx4help
      BJ

        • 1. Re: jbpm beginner questions
          benitojuarez

          Another Problem:


          this method:



              public void test()
              {
                log.info("test(): start");
                JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
                        
                log.info("test(): get context");
                JbpmContext jbpmContext = jbpmConfiguration.getCurrentJbpmContext();
                    
                    log.debug("JbpmContext initialized successfully #0",jbpmContext);
                    List tasks = jbpmContext.getTaskList();
                    
                    log.info("test() Tasks: #0 for actor:#1",tasks,jbpmContext.getActorId());
              }





          throws the following exeption:



          10:51:52,116 INFO  [TaskListBean] test(): start
          10:51:52,116 INFO  [TaskListBean] test(): get context
          10:51:52,116 ERROR [TxPolicy] javax.ejb.EJBTransactionRolledbackException
          10:51:54,991 INFO  [compiler] Added Library from: vfszip:/C:/Program Files/jboss-5.0.1.GA/server/default/deploy/Test-Workflow.ear/Test-Workflow.war/WEB-INF/lib/jboss-seam-rss.jar/META-INF/seam-rss.taglib.xml
          10:51:54,991 INFO  [compiler] Added Library from: vfszip:/C:/Program Files/jboss-5.0.1.GA/server/default/deploy/Test-Workflow.ear/Test-Workflow.war/WEB-INF/lib/jboss-seam-mail.jar/META-INF/seam-mail.taglib.xml
          10:51:54,991 INFO  [compiler] Added Library from: vfszip:/C:/Program Files/jboss-5.0.1.GA/server/default/deploy/Test-Workflow.ear/Test-Workflow.war/WEB-INF/lib/jboss-seam-ui.jar/META-INF/s.taglib.xml
          10:51:54,991 INFO  [compiler] Added Library from: vfszip:/C:/Program Files/jboss-5.0.1.GA/server/default/deploy/Test-Workflow.ear/Test-Workflow.war/WEB-INF/lib/jsf-facelets.jar/META-INF/jsf-core.taglib.xml
          10:51:55,007 INFO  [compiler] Added Library from: vfszip:/C:/Program Files/jboss-5.0.1.GA/server/default/deploy/Test-Workflow.ear/Test-Workflow.war/WEB-INF/lib/jsf-facelets.jar/META-INF/jsf-html.taglib.xml
          10:51:55,007 INFO  [compiler] Added Library from: vfszip:/C:/Program Files/jboss-5.0.1.GA/server/default/deploy/Test-Workflow.ear/Test-Workflow.war/WEB-INF/lib/jsf-facelets.jar/META-INF/jsf-ui.taglib.xml
          10:51:55,007 INFO  [compiler] Added Library from: vfszip:/C:/Program Files/jboss-5.0.1.GA/server/default/deploy/Test-Workflow.ear/Test-Workflow.war/WEB-INF/lib/jsf-facelets.jar/META-INF/jstl-core.taglib.xml
          10:51:55,007 INFO  [compiler] Added Library from: vfszip:/C:/Program Files/jboss-5.0.1.GA/server/default/deploy/Test-Workflow.ear/Test-Workflow.war/WEB-INF/lib/jsf-facelets.jar/META-INF/jstl-fn.taglib.xml
          10:51:55,022 INFO  [compiler] Added Library from: vfszip:/C:/Program Files/jboss-5.0.1.GA/server/default/deploy/Test-Workflow.ear/Test-Workflow.war/WEB-INF/lib/jboss-seam-excel.jar/META-INF/seam-excel.taglib.xml
          10:51:55,022 INFO  [compiler] Added Library from: vfszip:/C:/Program Files/jboss-5.0.1.GA/server/default/deploy/Test-Workflow.ear/Test-Workflow.war/WEB-INF/lib/jboss-seam-pdf.jar/META-INF/seam-pdf.taglib.xml
          10:51:55,022 INFO  [compiler] Added Library from: vfszip:/C:/Program Files/jboss-5.0.1.GA/server/default/deploy/Test-Workflow.ear/Test-Workflow.war/WEB-INF/lib/richfaces-ui.jar/META-INF/a4j.taglib.xml
          10:51:55,022 INFO  [compiler] Added Library from: vfszip:/C:/Program Files/jboss-5.0.1.GA/server/default/deploy/Test-Workflow.ear/Test-Workflow.war/WEB-INF/lib/richfaces-ui.jar/META-INF/ajax4jsf.taglib.xml
          10:51:55,038 INFO  [compiler] Added Library from: vfszip:/C:/Program Files/jboss-5.0.1.GA/server/default/deploy/Test-Workflow.ear/Test-Workflow.war/WEB-INF/lib/richfaces-ui.jar/META-INF/jsp.taglib.xml
          10:51:55,038 INFO  [compiler] Added Library from: vfszip:/C:/Program Files/jboss-5.0.1.GA/server/default/deploy/Test-Workflow.ear/Test-Workflow.war/WEB-INF/lib/richfaces-ui.jar/META-INF/rich.taglib.xml
          10:51:55,038 INFO  [compiler] Added Library from: vfszip:/C:/Program Files/jboss-5.0.1.GA/server/default/deploy/Test-Workflow.ear/Test-Workflow.war/WEB-INF/lib/richfaces-ui.jar/META-INF/richfaces.taglib.xml





          the exception message isnt very useful.
          what could it mean?

          • 2. Re: jbpm beginner questions
            cash1981

            Perhaps you should do a try catch and write e.printStackTrace to see the problem.

            • 3. Re: jbpm beginner questions
              benitojuarez

              you're right, the real exception wasn't shown. It was a null pointer!




              JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
              JbpmContext jbpmContext = jbpmConfiguration.getCurrentJbpmContext();
              




              jbpmContext was null. Whats leads to the question, how to create a current jbpm context.



              thx
              BJ




              • 4. Re: jbpm beginner questions
                cash1981

                Maybe like this?


                JbpmContext jbpmContext = JbpmConfiguration.getInstance().createJbpmContext();
                               try {
                                    //do something
                               } finally {
                                    jbpmContext.close();
                               }



                • 5. Re: jbpm beginner questions
                  benitojuarez

                  yes, i tried this in the authenticator-bean to set the jbpm context (and its actor-id) at the start of the session. But some clicks away the context seems to be gone.