AnsweredAssumed Answered

Unable to init the processEngine correctly

Question asked by maurizio.vacca on Aug 11, 2014
Latest reply on Aug 11, 2014 by maurizio.vacca
Hi all,

in my company we're trying to integrate Activiti inside our web application in order to use it as a workflow manager basically. So I created the diagram and I'm now trying to deploy it and then I added the requested jars inside a WEB-INF's subfolder, including also the activiti.cfg.xml file.
Unfortunately, as soon as I try to initiate a new processEngine an exception occurs and I'm stuck here. The exception thrown is the following:

GRAVE: Servlet.service() for servlet RestServlet threw exception
java.lang.NullPointerException
   at acceleratore.controller.DecController.deployWorkflow(DecController.java:41)
   at acceleratore.components.webservice.rest.DecWorkflowManager.deployWorkflow(DecWorkflowManager.java:19)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
   at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
   at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
   at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
   at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
   at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
   at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
   at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
   at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)
   at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)
   at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
   at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
   at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
   at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)
   at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at clime.messadmin.filter.MessAdminFilter.doFilter(MessAdminFilter.java:104)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at acceleratore.controller.http.BalanceFilter.doFilter(BalanceFilter.java:86)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Unknown Source)


Here the code for the DecController constructor (notice that the log message "Unable to create the processEngine" is printed as expected before the stack trace)

public DecController(){
      processEngine = ProcessEngines.getDefaultProcessEngine();
      if(processEngine != null){
         logger.debug("Creating new DecController: " + processEngine.getName());
      }
      else{
         logger.error("Unable to create the processEngine");
      }
   }


Last, the activiti configuration file used (DB references are omitted intentionally here, they're correctly setup in the configuration file).
[blockcode]
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd" >

  <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
    <property name="databaseType" value="oracle" />
    <property name="jdbcUrl" value="jdbc:oracle:thin:@xxx.xx.xx.xxx:xxxx:orcl" />
    <property name="jdbcDriver" value="oracle.jdbc.OracleDriver" />
    <property name="jdbcUsername" value="xxx" />
    <property name="jdbcPassword" value="xxx" />
   
    <property name="databaseSchemaUpdate" value="true" />
   
    <property name="jobExecutorActivate" value="false" />
   
    <property name="mailServerHost" value="mail.my-corp.com" />
    <property name="mailServerPort" value="5025" />   
  </bean>

</beans>
[/blockcode]
Thanks and Best Regards,

Maurizio

Outcomes