0
votes

I am trying to integrate jBPM 5.4 into an existing servlet.

The servlet runs fine with JBoss 7.1 but it fails with a thrown exception when I add a single jBPM related API. (I used the evaluation sample from the jbpm-5.4.0.Final-installer-full.zip installation as a template.) I added to the servlet's doPost():

KnowledgeBuilder kbuilder = KnowledgeBuilderFactor.newKnowledgeBuilder()

and the following exception is thrown as soon as we execute this statement:

20:51:06,394 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/myservlet].[myservlet]] (http-localhost-127.0.0.1-8080-2) Servlet.service() for servlet myservlet threw exception: java.lang.NoClassDefFoundError: org/drools/builder/KnowledgeBuilderFactory at com.mycompany.myservlet.doPost(myservlet.java:413) [classes:] at com.mycompany.myservlet.doGet(myservlet.java:120) [classes:] at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final] at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:] at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_11]

We also have:

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;

Can someone please explain what has gone wrong here?

Thank you. Al

1

1 Answers

0
votes

You need to make sure that the following class: org/drools/builder/KnowledgeBuilderFactory is inside your project classpath (the whole jar file that contains it) and it's also inside your WEB-INF/lib directory inside it's correspondent jar file. Doing that will make it work, this doesn't seems to be a Drools or jBPM question at all.. is more related with Web Applications in General.