0 Replies Latest reply on Oct 7, 2013 7:17 PM by Al Koch

    How do I locate/add the jBPM 5.4 Maven dependencies into my Maven JavaEE6 Web app?

    Al Koch Newbie

      Hello,

       

      I am trying to integrate jBPM 5.4 into an Eclipse (Kepler) Maven generated Project but I don't know how to locate the necessary Maven dependencies.  As a test I am simply trying to replicate the code found in the jBPM Full Installer's evaluation sample into the template code produced by a Maven JavaEE6 Archetype.

       

      I have done the following:

      1) JBoss Central > Maven Project > filter on "javaee6" (to create the "myservlet" Project):

          Archetype = jboss-javaee6-webapp

          Accept all defaults

       

      2) In src\main\java\com\mycompany\mywebapp\controller add to (arbitrarily chosen) MemberRegistration.java (which was automatically created as part of the Project) the following which comes from the evaluation sample code:

      import java.util.HashMap;

      import java.util.Map;

      import org.drools.KnowledgeBase;

      import org.drools.builder.KnowledgeBuilder;

      import org.drools.builder.KnowledgeBuilderFactory;

      import org.drools.builder.ResourceType;

      import org.drools.io.ResourceFactory;

      import org.drools.logger.KnowledgeRuntimeLogger;

      import org.drools.logger.KnowledgeRuntimeLoggerFactory;

      import org.drools.runtime.StatefulKnowledgeSession;

      import org.jbpm.process.workitem.wsht.HornetQHTWorkItemHandler;

       

      3) In this same module, in register() add the following which also comes from the evaluation sample code:

      try {

          // load up the knowledge base

          KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

          kbuilder.add(ResourceFactory.newClassPathResource("Evaluation.bpmn"), ResourceType.BPMN2);

          KnowledgeBase kbase = kbuilder.newKnowledgeBase();

          StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

          HornetQHTWorkItemHandler humanTaskHandler = new HornetQHTWorkItemHandler(ksession);

          humanTaskHandler.setIpAddress("127.0.0.1");

          humanTaskHandler.setPort(5153);

          ksession.getWorkItemManager().registerWorkItemHandler("Human Task", humanTaskHandler);

          KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession, "test", 1000);

          // start a new process instance

          Map<String, Object> params = new HashMap<String, Object>();

          params.put("employee", "krisv");

          params.put("reason", "Yearly performance evaluation");

          ksession.startProcess("com.sample.evaluation", params);

          System.out.println("Process started ...");

          logger.close();

          } catch (Throwable t) {

          t.printStackTrace();

      }

       

      In an earlier incident (http://stackoverflow.com/questions/19131052/cant-integrate-jbpm-5-4-into-a-maven-web-app) Salaboy indicated that rather than manually add the jBPM runtime to the build path and add the runtime files to the Deployment Assembly I just needed to "add the Maven dependencies" to the Project.

       

      I found the sample @ http://www.mastertheboss.com/jbpm5/jbpm-5-and-maven-example-project and added the <properties> and <dependencies> shown there to my pom.xml but the import statements are still showing as "unresolved".

       

      Can someone explain how to "locate and use the Maven dependencies" to get this project working?

       

      Thank you.