1 Reply Latest reply on Jul 17, 2008 6:39 AM by Ronald van Kuijk

    jboss error with servlet and jbpm-console

    Ashish Chawla Newbie

      Hi All,
      I created a simple workflow with one node which just prints out the message. I deployed this in jbpm using eclipse and then tested it through the UI..http://localhost:8080/jbpm-console and all looks good.

      here is the WF xml

      <?xml version="1.0" encoding="UTF-8"?>
      <process-definition xmlns="urn:jbpm.org:jpdl-3.2"
       name="first-demo-process">
       <start-state name="start-state1">
       <transition to="node1"></transition>
       </start-state>
       <node name="node1">
       <action class="com.sample.action.MessageActionHandler">
       <message>ashish sending message1</message>
       </action>
       <transition to="end-state1"></transition>
       </node>
       <end-state name="end-state1"></end-state>
      </process-definition>


      Now I created a servlet and deployed that, which hopefully will invoke the WF described above..here is the code for that..

      package com.ashish.test;
      
      import java.io.IOException;
      import java.io.PrintWriter;
      import javax.servlet.ServletException;
      import javax.servlet.http.HttpServlet;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      
      import java.util.HashMap;
      import org.jbpm.JbpmConfiguration;
      import org.jbpm.JbpmContext;
      import org.jbpm.db.GraphSession;
      import org.jbpm.graph.def.ProcessDefinition;
      import org.jbpm.graph.exe.ProcessInstance;
      
      public class WFTriggerServlet extends HttpServlet {
       /**
       * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
       * @param request servlet request
       * @param response servlet response
       */
       protected void processRequest(HttpServletRequest request, HttpServletResponse response)
       throws ServletException, IOException {
       response.setContentType("text/html;charset=UTF-8");
       PrintWriter out = response.getWriter();
       try {
       out.println("inside processRequest function");
       out.println(startProcess(16, "first-demo-process", null, null, true));
       out.println("Ending call");
       } finally {
       out.close();
       }
       }
      
       public long startProcess(long processId, String processName, String key, HashMap processVariables, boolean signalStart) {
       long tokenId = 0;
       JbpmConfiguration jbpmConfig = null;
       JbpmContext jbpmContext = null;
       try {
      
       if (jbpmConfig == null) {
       jbpmConfig = JbpmConfiguration.getInstance();
       }
       jbpmContext = jbpmConfig.createJbpmContext();
       } catch (Exception e) {
       return -1; //e.getMessage().toString();
       }
       try {
       // get the session and process definition according to the process id
       GraphSession graphSession = jbpmContext.getGraphSession();
      
       ProcessDefinition processDefinition = null;
       if (processName.length() > 0) {
       processDefinition = graphSession.findLatestProcessDefinition(processName);
       } else {
       processDefinition = graphSession.getProcessDefinition(processId);
       }
      
       // if there are no process variables, then create an empty variable list
       if (processVariables == null) {
       processVariables = new HashMap();
       }
       // startup the process, set its business key (for correlation purposes, and
       // signal it to start going with the flow
       ProcessInstance processInstance = processDefinition.createProcessInstance(processVariables);
      
       processInstance.setKey(key);
       tokenId = processInstance.getRootToken().getId();
       if (signalStart) {
       processInstance.signal();
       }
       } finally {
       jbpmContext.close();
       }
       return tokenId;
       }
      }
      


      I copied the .war file for the servlet to /opt/software/jbpm-jpdl-3.2.3/server/server/jbpm/deploy/

      and i see this on the console...

      09:57:20,150 INFO [TomcatDeployer] deploy, ctxPath=/WFTrigger, warUrl=.../tmp/deploy/tmp21005WFTrigger-exp.war/
      09:57:20,697 INFO [WebappClassLoader] validateJarFile(/opt/software/jbpm-jpdl-3.2.3/server/server/jbpm/./tmp/deploy/tmp21005WFTrigger-exp.war/WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class


      Now when I try to hit http://localhost:8080/jbpm-console/sa/processes.jsf I am not able to view the JBPM page also and am getting this error on the console...

      09:58:29,248 INFO [STDOUT] 09:58:29,248 INFO [JbpmConfiguration] using jbpm configuration resource 'jbpm.cfg.xml'
      10:00:06,746 WARN [lifecycle] executePhase(RESTORE_VIEW 1,com.sun.faces.context.FacesContextImpl@62a404) threw exception
      javax.faces.application.ViewExpiredException: viewId:/sa/processes.jsf - View /sa/processes.jsf could not be restored.
       at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:187)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       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:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
       at java.lang.Thread.run(Thread.java:619)
      10:00:06,749 WARN [lifecycle] phase(RESTORE_VIEW 1,com.sun.faces.context.FacesContextImpl@62a404) threw exception: java.lang.NullPointerException null
      org.jboss.gravel.common.phase.GravelPhaseListener.afterPhase(GravelPhaseListener.java:112)
      com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
      com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
      org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      java.lang.Thread.run(Thread.java:619)
      
      10:00:06,749 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
      javax.faces.application.ViewExpiredException: viewId:/sa/processes.jsf - View /sa/processes.jsf could not be restored.
       at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:187)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       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:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
       at java.lang.Thread.run(Thread.java:619)
      


      Can anyone please help me with this ? Its really confusing for me as i am doing it for the first time....

      Thanks
      Ashish