12 Replies Latest reply on Sep 26, 2008 4:12 PM by jwooten

    jBPM 3.2.1 and Sub-Process

    drashmi

      Hi,

      I am presently working on the stable version of jbpm-jpdl-3.2.1 and have downloaded the jbpm-jpdl-suite-3.2.1.zip.

      While trying to test for a process having a sub-process, I am getting an error:

      Error starting process: An exception of type "org.jbpm.JbpmException" was thrown. The message is: can't create a process instance when processDefinition is null

      The process followed by me for testing is that I deploy the sub-process first and then the main process.

      Please find the main process and the sub-process definitions below:

      simpleSubProcess1.par

      <?xml version="1.0" encoding="UTF-8"?>
      
      <process-definition
       xmlns="urn:jbpm.org:jpdl-3.2"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="urn:jbpm.org:jpdl-3.2 http://docs.jboss.org/jbpm/xsd/jpdl-3.2.xsd" name="simpleSubProcess1">
      
       <start-state name="start">
      
       <transition name="" to="state1"></transition>
      
       </start-state>
      
       <state name="state1">
      
       <transition name="" to="node1"></transition>
      
       </state>
      
       <node name="node1">
       <action class="org.jbpm.tutorial.action.SimpleActionHandler"/>
      
       <transition name="" to="state2"></transition>
      
       </node>
      
       <state name="state2">
      
       <transition name="" to="end1"></transition>
      
       </state>
      
       <end-state name="end1"></end-state>
      </process-definition>
      


      simpleMainProcess1.par
      <?xml version="1.0" encoding="UTF-8"?>
      
      <process-definition
       xmlns="urn:jbpm.org:jpdl-3.2"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="urn:jbpm.org:jpdl-3.2 http://docs.jboss.org/jbpm/xsd/jpdl-3.2.xsd" name="simpleMainProcess1">
       <start-state name="start">
       <transition name="" to="process1"></transition>
       </start-state>
       <process-state name="process1">
       <sub-process name="simpleSubProcess1"></sub-process>
       <transition name="" to="end1"></transition>
       </process-state>
       <end-state name="end1"></end-state>
      </process-definition>
      

      Any help in this regard will be very useful for me. Kindly share your experiences and knowledge and help me to solve this problem.

        • 1. Re: jBPM 3.2.1 and Sub-Process
          kukeltje

          deploy them in the correct order (subprocess first) if you want this specific version of the subprocess to be bound to the main process. If you always want the latest version bound to the main process add the attribute binding="late" to the main process process state

          • 2. Re: jBPM 3.2.1 and Sub-Process
            kukeltje

            hmmm... sorry.. I see you deloyed in the correct order... sure it IS deployed (no errors?)

            • 3. Re: jBPM 3.2.1 and Sub-Process
              drashmi

              The same process definition I am able to run in jbpm-jpdl-3.2.GA but when I am trying to run it in jbpm-jpdl-3.2.1, I am getting this error.

              What can be the possible causes for this other than the order in which the processes are deployed?

              Kindly help me out as this is quite urgent.

              Thanks in advance

              • 4. Re: jBPM 3.2.1 and Sub-Process
                kukeltje

                if it is urgent, take the source, add some debug statements to it and see why it goes wrong. Or buy commercial support somewhere.

                What could be wrong is what I mentioned before, the subprocess is not deployed at all due to some other error

                • 5. Re: jBPM 3.2.1 and Sub-Process
                  drashmi

                  Hi,

                  I am sorry for the delayed reply.

                  Actually, the sub-process gets deployed properly because I am able to start an instance of the sub-process but only when the main process makes a call to sub-process, it fails to create an instance and gives me the above mentioned error.

                  • 6. Re: jBPM 3.2.1 and Sub-Process
                    drashmi

                    Hi,

                    I have been able to resolve the problem.

                    In order to use sub-process in jbpm-jpdl-3.2.1, you should change the jbpm.cfg.xml in jbpm-console.war to include the customised bean class.

                    If you include the following:

                    <bean name="jbpm.sub.process.resolver" class="org.jbpm.custom.DbSubProcessResolver" />


                    in your jbpm.cfg.xml and build the war file again, I hope you can then successfully deploy and create a process instance which in turn makes a cal to a sub-process.

                    Thanks.

                    • 7. Re: jBPM 3.2.1 and Sub-Process
                      kukeltje

                      hmmmmm...... where does that org.jbpm.custom.DbSubProcessResolver come from??? Did you develop that by yourself? It is not in the jbpm source. If so, it is no wonder it won't work, but it only does not work for you then.

                      • 8. Re: jBPM 3.2.1 and Sub-Process
                        drashmi

                        In case you are finding it difficult to deploy a process-definition having a sub-process, then use the below class:
                        org.jbpm.graph.node.DbSubProcessResolver.java

                        Use this class in jbpm.cfg.xml:

                        <bean name="jbpm.sub.process.resolver" class="org.jbpm.graph.node.DbSubProcessResolver" />
                        


                        and build the jbpm-console.war again.

                        • 9. Re: jBPM 3.2.1 and Sub-Process
                          kukeltje

                          ????? isn't this the default???

                          • 10. Re: jBPM 3.2.1 and Sub-Process
                            drashmi

                            At least it didnt work for me. Only after I included this in my jbpm.cfg.xml, then only the sub-process started getting executed properly. Otherwise I was getting an exception saying "cannot create a process instance when process definition is null"

                            • 11. Re: jBPM 3.2.1 and Sub-Process
                              kukeltje

                              didn't you have an old jbpm.cfg.xml? e.g. one from 3.1?

                              • 12. Re: jBPM 3.2.1 and Sub-Process
                                jwooten

                                I have a working process and deployed it. I tested it.
                                I then have a simple process which starts and has the first node as a process-start.
                                I added the bean you mentioned into my jbpm.cfg.xml file and recompiled and deployed the console.

                                I get the same error, null pointer.

                                Any other ways I can get the subprocess to start?