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

    Starting Process Instance and Webapp

    Niklas Schulz Newbie

      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.