5 Replies Latest reply on Jan 9, 2007 3:17 PM by nib

    Starting Process Instance and Webapp

    nib

      Hi,
      I start an process instance from a mdb via the following code:

      private void kickOffProcess(String processname, String [] attrnames, java.io.Serializable[] attrvalues) {
       try {
       // Logging
       log.info("!!! MDB: KickOff "+processname);
       for (int i=0;i<attrnames.length;i++)
       log.info("!!! MDB: Parameter "+attrnames);
      
       log.info("!!! MDB: Initialisize jBPM");
       org.jbpm.JbpmConfiguration jbpmConfiguration = org.jbpm.JbpmConfiguration.parseXmlString(
       "<jbpm-configuration>" +
      
       // A jbpm-context mechanism separates the jbpm core
       // engine from the services that jbpm uses from
       // the environment.
      
       " <jbpm-context>" +
       " <service name='persistence' " +
       " factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />" +
       " </jbpm-context>" +
      
       // Also all the resource files that are used by jbpm are
       // referenced from the jbpm.cfg.xml
      
       " <string name='resource.hibernate.cfg.xml' " +
       " value='config/hibernate.cfg.xml' />" +
       "</jbpm-configuration>"
       );
       org.jbpm.JbpmContext jbpmcontext =jbpmConfiguration.createJbpmContext();
      
      
       log.info("!!! MDB: Create Instance");
      
      
       org.jbpm.graph.exe.ProcessInstance pi = jbpmcontext.newProcessInstance(processname);
      
       log.info("!!! MDB: Set Parameter");
       for (int i=0;i<attrnames.length;i++)
       pi.getContextInstance().setVariable(attrnames,attrvalues);
       log.info("!!! MDB: Signall");
       pi.signal();
       log.info("!!! MDB: Signal");
       jbpmcontext.close();
      
       } catch (Exception ex) {
       log.info("!!! ERROR MDB: Unknown Exception. Reason: "+ex);
       ex.printStackTrace();
       }
      
      
       }
      
      
      
       }
      



      It starts the process and tasks are assigend to the user "ernie" (according to the log).
      DEBUG [GraphElement] event 'task-create' on 'Task(Check Customer)' for 'Token(/customer)'
       DEBUG [TaskInstance] assigning task 'Check Customer' to 'ernie'



      The task-code
       <swimlane name="Worker">
       <assignment expression="user(ernie)"></assignment>
       </swimlane>
      
      [..]
      
      <task-node name="Check Customer">
       <task swimlane="Worker">
       </task>
       <transition name="Check done" to="join1"></transition>
       </task-node>
      
      


      The Problem is: In the Webapp (jBPM 3.2 alpha 2) it does not appear on ernies tasklist.
      Don't know whats wrong.

        • 1. Re: Starting Process Instance and Webapp
          nib

          And by the way:
          WARN [ProxyWarnLog] Narrowing proxy to class org.jbpm.graph.node.TaskNode - this operation breaks ==

          What does that mean?

          The line before that is
          DEBUG [GraphElement] event 'node-enter' on 'TaskNode(Check Customer)' for 'Token(/Customer)'
          2

          • 2. Re: Starting Process Instance and Webapp
            nib

            My code is mainly based on the websale example in the 3.2 alpha 2 suite. The exception is that I have some Node Nodes until the Task Node is executed (the node nodes do start). In the DB is a copy of the process instance.

            • 3. Re: Starting Process Instance and Webapp
              nib

              Does no one has an idea or any tips what I can try?
              Can I improve the source for "kicking off" a process?
              Thank you in advance.

              • 4. Re: Starting Process Instance and Webapp
                asmo

                Have you looked in the database, weather the task assignment is correct?

                Have you tried , weather the tasklist form ernie is correct in the assignment handler?

                • 5. Re: Starting Process Instance and Webapp
                  nib

                  @assigment The console told me it assigned the task to ernie, but I can look in the db. Also this won't help me much, because I wouldn't know how to fix it ;-)

                  @tasklist form yes it should be correct because it is from the (working) websale example. Even if the form is wrong there should be a task in ernies list