8 Replies Latest reply on Jan 19, 2016 12:03 AM by Jyotsna Doddi

    unable start a jbpm process with servlet

    Domenico Schiavone Newbie

      hello to all,

      I'm trying to start a jbpm process as a method of a servlet inside a dynamic web project

       

      this is the output console:

      ----------

      ----------  Servlet Initialized successfully ----------

      ----------

      0    [ContainerBackgroundProcessor[StandardEngine[Catalina]]] WARN  org.drools.compiler.kie.builder.impl.ClasspathKieProject  - Unable to load pom.properties tried recursing down from/home/ivan/j2ee/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/venerdi/WEB-INF/classes

      null

      1    [ContainerBackgroundProcessor[StandardEngine[Catalina]]] ERROR org.drools.compiler.kie.builder.impl.ClasspathKieProject  - Unable to build index of kmodule.xml url=file:/home/ivan/j2ee/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/venerdi/WEB-INF/classes/META-INF/kmodule.xml

      null

      4    [ContainerBackgroundProcessor[StandardEngine[Catalina]]] WARN  org.drools.compiler.kie.builder.impl.ClasspathKieProject  - Unable to load pom.properties tried recursing down from/home/ivan/j2ee/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/venerdi/WEB-INF/classes

      null

      4    [ContainerBackgroundProcessor[StandardEngine[Catalina]]] ERROR org.drools.compiler.kie.builder.impl.ClasspathKieProject  - Unable to build index of kmodule.xml url=file:/home/ivan/j2ee/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/venerdi/WEB-INF/classes/META-INF/kmodule.xml

      null

      ott 31, 2014 5:15:04 PM org.apache.catalina.core.ApplicationContext log

      Grave: StandardWrapper.Throwable

      java.lang.RuntimeException: The requested KieBase "kbase" does not exist

          at org.drools.compiler.kie.builder.impl.KieContainerImpl.createKieBase(KieContainerImpl.java:288)

          at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:257)

          at venerdi.VenerdiServlet.init(VenerdiServlet.java:37)

          at javax.servlet.GenericServlet.init(GenericServlet.java:158)

          at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)

          at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)

          at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)

          at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5231)

          at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5518)

          at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

          at org.apache.catalina.core.StandardContext.reload(StandardContext.java:4009)

          at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:425)

          at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1345)

          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1546)

          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1556)

          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1556)

          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1524)

          at java.lang.Thread.run(Thread.java:745)

       

      ott 31, 2014 5:15:04 PM org.apache.catalina.core.StandardContext loadOnStartup

      Grave: Servlet /venerdi threw load() exception

      java.lang.RuntimeException: The requested KieBase "kbase" does not exist

          at org.drools.compiler.kie.builder.impl.KieContainerImpl.createKieBase(KieContainerImpl.java:288)

          at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:257)

          at venerdi.VenerdiServlet.init(VenerdiServlet.java:37)

          at javax.servlet.GenericServlet.init(GenericServlet.java:158)

          at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)

          at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)

          at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)

          at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5231)

          at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5518)

          at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

          at org.apache.catalina.core.StandardContext.reload(StandardContext.java:4009)

          at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:425)

          at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1345)

          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1546)

          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1556)

          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1556)

          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1524)

          at java.lang.Thread.run(Thread.java:745)

       

      ott 31, 2014 5:15:04 PM org.apache.catalina.core.StandardContext reload

      Informazioni: Reloading Context with name [/venerdi] is completed

       

      the contents of servlet is:

      super.init();

                System.out.println("----------");

                System.out.println("----------  Servlet Initialized successfully ----------");

                System.out.println("----------");

             

                KieServices ks = KieServices.Factory.get();

                KieContainer kContainer = ks.getKieClasspathContainer();

                KieBase kbase = kContainer.getKieBase("kbase");

       

                RuntimeManager manager = createRuntimeManager(kbase);

                RuntimeEngine engine = manager.getRuntimeEngine(null);

                KieSession ksession = engine.getKieSession();

       

                ksession.startProcess("com.sample.bpmn.hello");

       

                manager.disposeRuntimeEngine(engine);

            }

       

            private RuntimeManager createRuntimeManager(KieBase kbase) {

                JBPMHelper.startH2Server();

                JBPMHelper.setupDataSource();

                EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa");

              RuntimeEnvironmentBuilder builder = RuntimeEnvironmentBuilder.Factory.get()

                  .newDefaultBuilder().entityManagerFactory(emf)

                  .knowledgeBase(kbase);

                return RuntimeManagerFactory.Factory.get()

                    .newSingletonRuntimeManager(builder.get(), "com.sample:example:1.0");

            }

       

       

       

      Hepl me????