4 Replies Latest reply on Dec 2, 2005 5:33 PM by Koen Aers

    Deployment of processes with process-state nodes

    Eduardo Jimenez Newbie

      Hi,

      I was wondering if anyone has seen this, but upon deployment of a process definition that has a process-state in it, I'm not having any luck making jBPM populate the SUPERSTATE_ column in the db. I'm using jBPM 3.0.1.

      yes, I am deploying the target process first.

      Thanks,

      Ed

        • 2. Re: Deployment of processes with process-state nodes
          Eduardo Jimenez Newbie

          Guys, I think I found the problem.

          I'm using the ProcessArchiveDeployer to deploy processes from ant and parent processes are not being linked. From the ProcessState code:

          if (jbpmSession != null) {
          
           // now, we must be able to find the sub-process
           if (subProcessName != null) {
          
           // if the name and the version are specified
           if (subProcessVersion != null) {
          
           try {
           int version = Integer.parseInt(subProcessVersion);
           // select that exact process definition as the subprocess definition
           subProcessDefinition = jbpmSession.getGraphSession().findProcessDefinition(subProcessName, version);
          
           } catch (NumberFormatException e) {
           jpdlReader.addWarning("version in process-state was not a number: " + processStateElement.asXML());
           }
          
           } else { // if only the name is specified
           // select the latest version of that process as the subprocess
           // definition
           subProcessDefinition = jbpmSession.getGraphSession().findLatestProcessDefinition(subProcessName);
           }
           } else {
           jpdlReader.addWarning("no sub-process name specified in process-state " + processStateElement.asXML());
           }
           }
          


          if there is no session open, it simply won't look for the parent process.

          Now, from the ProcessArchiveDeployer:

          public static void deployZipInputStream(ZipInputStream zipInputStream, JbpmSessionFactory jbpmSessionFactory) {
           ProcessDefinition processDefinition = ProcessDefinition.parseParZipInputStream(zipInputStream);
           deployProcessDefinition(processDefinition, jbpmSessionFactory);
           }
          


          It reads the process definition first, then calls deploy, which opens the first jbpmSession!!!. The session must be open first before attempting to deploy!.

          Now, you might say, use the ant task, but the bug is still there:

          private void deploy(File file, JbpmSessionFactory jbpmSessionFactory) throws IOException, FileNotFoundException {
           ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(file));
           ProcessArchiveDeployer.deployZipInputStream(zipInputStream,jbpmSessionFactory);
           }
          


          See, the ant task doens't open a jbpmSession either, so its up to ProcessArchiveDeployer.deployZipInputStream() to do it, which is the same method I'm having an issue with.

          Examining ProcessArchiveDeployer, every way of deploying a process would have the same problem.

          I'll open an issue and try to create a unit test to reproduce it.

          • 3. Re: Deployment of processes with process-state nodes
            Eduardo Jimenez Newbie

            I meant the session must be open before attempting to parse.

            • 4. Re: Deployment of processes with process-state nodes
              Koen Aers Master

              You are a hero, thanks ;-)

              Regards,
              Koen