4 Replies Latest reply on Jul 17, 2008 6:22 AM by Ronald van Kuijk

    Error when calling a process from a java class

    subhajit sidhanta Newbie

      Hi,

      I am calling a JBPM process from a java class using the following code:

      JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseResource("jbpm.cfg.xml");
      //ProcessDefinition processDefinition=ProcessDefinition.parseParResource("D:\jbpm/src/process.examples/simple.par/processdefinition.xml");
      ProcessDefinition processDefinition=ProcessDefinition.parseParResource("simple.war/processdefinition.xml");
      JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
      ProcessInstance processInstance=new ProcessInstance();
      jbpmContext.deployProcessDefinition(processDefinition);
      Token token=processInstance.getRootToken();
      assertSame(processDefinition.getStartState(), token.getNode());
      token.signal();
      assertSame(processDefinition.getNode("first"), token.getNode());
      token.signal();
      assertSame(processDefinition.getNode("end"), token.getNode());


      On deploying the WR file I am getting this error in the above java class.

      description The server encountered an internal error () that prevented it from fulfilling this request.

      exception

      org.apache.jasper.JasperException: in is null
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)


      root cause

      java.lang.NullPointerException: in is null
      java.util.zip.ZipInputStream.(ZipInputStream.java:55)
      org.jbpm.graph.def.ProcessDefinition.parseParResource(ProcessDefinition.java:201)
      simple.CallProcess.testCallProcess(CallProcess.java:17)
      org.apache.jsp.CallMethod_jsp._jspService(org.apache.jsp.CallMethod_jsp:58)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)


      Please help me how can i solve this problem?
      thanks in anticipation.

        • 1. Re: Error when calling a process from a java class
          Ananth Sreepathi Newbie

          Hey,
          try using

          ProcessDefinition.parseXmlXXXXX(....);
          

          instead of
          ProcessDefinition.parseParResource("simple.war/processdefinition.xml");


          • 2. Re: Error when calling a process from a java class
            Ronald van Kuijk Master

            or use parseResource (there is no .par file here in a zip format, just a directory format as I see it)

            • 3. Re: Error when calling a process from a java class
              subhajit sidhanta Newbie

              Hi,

              I was busy doing other things.So could not reply.But I am still getting the error:

              org.jbpm.jpdl.JpdlException: [[ERROR] couldn't parse process definition]
              at org.jbpm.jpdl.xml.JpdlXmlReader.readProcessDefinition(JpdlXmlReader.java:163)
              at org.jbpm.graph.def.ProcessDefinition.parseXmlInputStream(ProcessDefinition.java:172)
              at org.jbpm.graph.def.ProcessDefinition.parseXmlResource(ProcessDefinition.java:153)
              at com.sample.CallProcess.testCallProcess(CallProcess.java:16)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at junit.framework.TestCase.runTest(TestCase.java:154)
              at junit.framework.TestCase.runBare(TestCase.java:127)
              at junit.framework.TestResult$1.protect(TestResult.java:106)
              at junit.framework.TestResult.runProtected(TestResult.java:124)
              at junit.framework.TestResult.run(TestResult.java:109)
              at junit.framework.TestCase.run(TestCase.java:118)
              at junit.framework.TestSuite.runTest(TestSuite.java:208)
              at junit.framework.TestSuite.run(TestSuite.java:203)
              at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
              at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
              at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


              Thanks in anticipation.

              • 4. Re: Error when calling a process from a java class
                Ronald van Kuijk Master

                uhmm... the simple.war should not be in there. It should be taking it from the classpath