2 Replies Latest reply on Mar 16, 2009 3:25 PM by leonel martin

    Sub-Process NullPointerException

    Sivajee Akula Newbie

      Hi all,

      I am getting a null-pointer exception when invoking a sub-process from a super-process.
      Here is my super process

      <?xml version="1.0" encoding="UTF-8"?>
      
      <process-definition name="BOJ Register Customer">
      
       <!-- NODES -->
      
       <start-state name="Initiate Process">
       <transition to="Approval Account" />
       </start-state>
      <process-state name = "Approval Account">
       <sub-process name = "Account Approval Process" />
       <variable name = "accountID" access = "read" mapped-name = "accountID" />
       <variable name = "customerID" access = "read" mapped-name = "customerID" />
       </process-state>
       <end-state name="end" />
      
      </process-definition>
      


      My Sub-Process is:
      <?xml version="1.0" encoding="UTF-8"?>
      
      <process-definition name="Account Approval Process">
      
       <!-- NODES -->
      
       <start-state name="Initiate Process">
       <transition to="Approve Account Node" />
       </start-state>
      
       <task-node name = "Approve Account Node">
       <task name = "ApproveAccount">
       <assignment expression = "group(manager)" />
       </task>
       <transition to = "end" />
       </task-node>
      
       <end-state name="end" />
      </process-definition>
      


      Here is my exception

      11:29:14,265 INFO [STDOUT] java.lang.NullPointerException: can't create a process instance when processDefinition is null
      11:29:14,265 INFO [STDOUT] at org.jbpm.graph.exe.ProcessInstance.<init>(ProcessInstance.java:60)
      11:29:14,265 INFO [STDOUT] at org.jbpm.graph.node.ProcessState.execute(ProcessState.java:86)
      11:29:14,265 INFO [STDOUT] at org.jbpm.graph.def.Node.enter(Node.java:284)
      11:29:14,265 INFO [STDOUT] at org.jbpm.graph.def.Transition.take(Transition.java:92)
      11:29:14,265 INFO [STDOUT] at org.jbpm.graph.def.Node.leave(Node.java:349)
      11:29:14,265 INFO [STDOUT] at org.jbpm.graph.node.TaskNode.leave(TaskNode.java:167)
      11:29:14,265 INFO [STDOUT] at org.jbpm.graph.exe.Token.signal(Token.java:127)
      11:29:14,265 INFO [STDOUT] at org.jbpm.graph.exe.Token.signal(Token.java:92)
      11:29:14,265 INFO [STDOUT] at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:342)
      11:29:14,265 INFO [STDOUT] at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:273)
      11:29:14,265 INFO [STDOUT] at com.tcs.jbpm.JbpmInterface.saveTaskInstance(JbpmInterface.java:361)
      11:29:14,265 INFO [STDOUT] at com.tcs.jbpm.JbpmInterface.finishTaskInstance(JbpmInterface.java:422)
      11:29:14,265 INFO [STDOUT] at com.tcs.joa.workflow.WorkflowAdapter.finishTaskInstance(WorkflowAdapter.java:70)
      11:29:14,265 INFO [STDOUT] at com.tcs.boj.ejb.AccountBeanImpl.insertAccount(AccountBeanImpl.java:88)
      11:29:14,265 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      11:29:14,265 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      11:29:14,265 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      11:29:14,265 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
      11:29:14,265 INFO [STDOUT] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
      11:29:14,265 INFO [STDOUT] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      11:29:14,265 INFO [STDOUT] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
      11:29:14,265 INFO [STDOUT] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
      11:29:14,265 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)
      11:29:14,265 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
      11:29:14,265 INFO [STDOUT] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:111)
      11:29:14,265 INFO [STDOUT] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      11:29:14,265 INFO [STDOUT] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      11:29:14,265 INFO [STDOUT] at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
      11:29:14,265 INFO [STDOUT] at org.jboss.ejb.Container.invoke(Container.java:709)
      11:29:14,265 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      11:29:14,265 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      11:29:14,265 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      11:29:14,265 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
      11:29:14,265 INFO [STDOUT] at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
      11:29:14,265 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:62)
      11:29:14,265 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:54)
      11:29:14,265 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:82)
      11:29:14,265 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:197)
      11:29:14,265 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
      11:29:14,265 INFO [STDOUT] at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:97)
      11:29:14,265 INFO [STDOUT] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:90)
      11:29:14,265 INFO [STDOUT] at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
      11:29:14,265 INFO [STDOUT] at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
      11:29:14,265 INFO [STDOUT] at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100)
      11:29:14,265 INFO [STDOUT] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
      11:29:14,265 INFO [STDOUT] at $Proxy153.insertAccount(Unknown Source)
      11:29:14,265 INFO [STDOUT] at com.tcs.boj.actions.BOJ0100EAction.createAccount(BOJ0100EAction.java:224)
      11:29:14,265 INFO [STDOUT] at com.tcs.boj.actions.BOJ0100EAction.save(BOJ0100EAction.java:175)
      11:29:14,265 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      11:29:14,265 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      11:29:14,265 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      11:29:14,265 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
      11:29:14,265 INFO [STDOUT] at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:276)
      11:29:14,265 INFO [STDOUT] at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:196)
      11:29:14,265 INFO [STDOUT] at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
      11:29:14,265 INFO [STDOUT] at com.tcs.joa.struts.JOARequestProcessor.processActionPerform(JOARequestProcessor.java:199)
      11:29:14,265 INFO [STDOUT] at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
      11:29:14,265 INFO [STDOUT] at com.tcs.joa.struts.JOARequestProcessor.process(JOARequestProcessor.java:139)
      11:29:14,265 INFO [STDOUT] at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
      11:29:14,265 INFO [STDOUT] at com.tcs.joa.struts.ActionServlet.process(ActionServlet.java:241)
      11:29:14,265 INFO [STDOUT] at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
      11:29:14,265 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      11:29:14,265 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
      11:29:14,265 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      11:29:14,265 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      11:29:14,265 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:158)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      11:29:14,265 INFO [STDOUT] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
      11:29:14,265 INFO [STDOUT] at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
      11:29:14,265 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
      11:29:14,265 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
      11:29:14,265 INFO [STDOUT] at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
      11:29:14,265 INFO [STDOUT] at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
      11:29:14,265 INFO [STDOUT] at java.lang.Thread.run(Thread.java:534)


      From seeing the exception, I got that its unable to get the sub-process's processdefinition. I had checked the jBPM code (org.jbpm.graph.node.ProcessState.execute method). In this method I havent found call for read method. So at what time the sub-process's processDefinition is made.

      Please help me in resolving this...

      Regards
      Pratap

        • 1. Re: Sub-Process NullPointerException
          Bernd Ruecker Master

          Hi Akula,

          this normaly means, that the process is not deployed yet.

          Is the deploy order of your processes correct, so that sub-processes are
          deployed at first?

          This results not in a Exception at deploy time (as I think it would bei
          nice) but in the described NullPointerException.

          • 2. Re: Sub-Process NullPointerException
            leonel martin Newbie

            try this...

            ProcessInstance instance = jbpmContext.newProcessInstance("ProcessName");
            ProcessInstance instanceEntrega = jbpmContext.newProcessInstance("SubProcessName");
            
            ProcessDefinition processDefinitionSubProcess = instanceEntrega.getProcessDefinition();
            ProcessState processState = (ProcessState) instance.getProcessDefinition().getNode("NameNode");
            processState.setSubProcessDefinition(processDefinitionSubProcess);