3 Replies Latest reply on May 7, 2015 8:05 AM by awizenm

    How to start a process (developed in BPMN2 Modeler) in a CDI application based on jBPM 6.2?

    awizenm

      Hi everybody,

       

      I developed a process using the BPMN2 Modeler.

      The process file is used in the RuntimeEnvironment producer as suggested in the documentation http://docs.jboss.org/jbpm/v6.2/userguide/jBPMIntegration.html#d0e19365

       

      The process is tested in a test class and it works.

       

      Now I try to start the process in the CDI application like this:

       

      KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit("myGroupId", "myArtifactId", "1.0");
      deploymentService.deploy(deploymentUnit);
      
      Map<String, Object> params = new HashMap<String, Object>();
      params.put("potentialOwner", "userA");
      long processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "mySimpleProcess", params);
      

       

      Unfortunately this does not work:

      org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact myGroupId:myArtifactId:jar:1.0 in central (http://repo1.maven.org/maven2/)

       

      My question is:

       

      How to start a process modelled with the "BPMN2 Modeler" using the CDI service?

        • 1. Re: How to start a process (developed in BPMN2 Modeler) in a CDI application based on jBPM 6.2?
          clp207

          Michael,

           

          The RuntimeEnvironment producer is mainly for pre 6.2 environments. The recommended approach in 6.2 is to package your process as a kjar in maven. This page and accompanying 6.2 examples are a good reference examples (Upgrade of jbpm-6-examples to jBPM 6.2 services | Jiri Svitak). The StartupBean in his examples replaces the EnvironmentProducer for deploying services.

           

          Once your process is packaged as a kjar, then your first two lines should find the artifact and deploy it correctly.

           

           

           

          • 2. Re: How to start a process (developed in BPMN2 Modeler) in a CDI application based on jBPM 6.2?
            awizenm

            Hi Chris,

             

            thank you for your suggestion.

             

            OK then. I will package my process as kjar and install it to my local maven.

             

            I have created my process with BPMN2 Modeler.

             

            How to package a process definition as kjar?

             

            I miss this crucial information in the 6.2 documentation.

            • 3. Re: How to start a process (developed in BPMN2 Modeler) in a CDI application based on jBPM 6.2?
              awizenm

              Many thanks to Chris and Francesco

               

              Deploying a kjar is not that difficult...

               

              To work with my process definition file as desired I have placed it in a separate minimal maven project.

               

              The most important thing is to add those lines to the pom of the new project:

               

              <packaging>kjar</packaging>
              
              <properties>
              <jbpm.version>6.2.0.Final</jbpm.version>
              </properties>
              
              <build>
              <plugins>
                <plugin>
                  <groupId>org.kie</groupId>
                  <artifactId>kie-maven-plugin</artifactId>
                <version>${jbpm.version}</version>
                  <extensions>true</extensions>
                </plugin>
              </plugins>
              </build>
              

               

              Eclipse complains about the plugin line, but installing of the kjar to maven works anyway.

               

              Now I can design my process using BPMN2 Modeller in my Luna Eclipse.

               

              Deployment with KModuleDeploymentUnit works as desired.

               

               

              KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit("com.sample", "myProcess", "1.0");
              deploymentService.deploy(deploymentUnit);
              
              Map<String, Object> params = new HashMap<String, Object>();
              params.put("potentialOwner", "userA");
              long processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "myProcessId", params);
              

               

               

              As a next step I will move the deployment lines to the StartupBean.

               

              Enclosed see my minimal project for process deployment.