2 Replies Latest reply on Jan 30, 2008 5:26 AM by inxaoc

    How to connfig sub-processes in 3.2.GA correctly

    inxaoc

      Hi!
      Please somebody gives for users right information about correct configuration for working with sub-processes. In docs this information very briefly!
      I get the following exception:

      org.jbpm.JbpmException: can't create a process instance when processDefinition is null
       org.jbpm.graph.exe.ProcessInstance.<init>(ProcessInstance.java:109)
       org.jbpm.graph.exe.ProcessInstance.<init>(ProcessInstance.java:91)
       org.jbpm.graph.exe.Token.createSubProcessInstance(Token.java:612)
       org.jbpm.graph.node.ProcessState.execute(ProcessState.java:157)
       org.jbpm.graph.def.Node.enter(Node.java:318)

      Deploying sub-process before deploying main-process doesn't solve problem: the same error I've got.
      This doesn't help too:
      <jbpm-configuration>
       <bean name="jbpm.sub.process.resolver" class="org.jbpm.graph.node.DbSubProcessResolver" />
      
      </jbpm-configuration>

      And when I can use binding?
      <process-state name="ext_tx_execution" binding="late">
       <sub-process name="ext_tx_execution" />
       <variable name="a" access="read,write" mapped-name="aa" />
       <variable name="b" access="read" mapped-name="bb" />
       <transition name="" to="end"></transition>
       </process-state>

      This code gives an exception:
      org.jbpm.jpdl.JpdlException: [[ERROR] line 32: cvc-complex-type.3.2.2: Attribute 'binding' is not allowed to appear in element 'sub-process'.]
       org.jbpm.jpdl.xml.JpdlXmlReader.readProcessDefinition(JpdlXmlReader.java:173)
       org.jbpm.jpdl.par.JpdlArchiveParser.readFromArchive(JpdlArchiveParser.java:51)
       org.jbpm.jpdl.par.ProcessArchive.parseProcessDefinition(ProcessArchive.java:81)

      Maybe there is other invisible for me things for solving this problem? Maybe if you would write instructions or examples for deploying sub-processes, it will be very good help for users!! And maybe do you have ready examples with working sub processes?
      When main-process meets <proccess-state> the process engine should take the provided (by name) process and find in DB the process which will be invoked as a sub-process? Why is the findLatestProcess method used? How does the execution depend on version of the main process and sub?
      Thanks in advance.

        • 1. Re: How to connfig sub-processes in 3.2.GA correctly
          kukeltje

          look at the unittests in the source... they show all kinds of examples...

          • 2. Re: How to connfig sub-processes in 3.2.GA correctly
            inxaoc

            What about binding late?

            I've tried unit test and it works. But in real execution I can set up the following code to define subProcess for super process:

            ProcessState processState = (ProcessState) superProcessDefinition.getNode("subprocessnode");
             processState.setSubProcessDefinition(subProcessDefinition);


            How to make it automatically!? I am deploying (programmatically) subprocess before main process.
            Please help me. I think it is a trivial question, but in your answer I didn't find solution! But I was reading other topics too. Why it works in test and doesn't work in reality correctly!?