<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
<table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tbody>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tbody>
<tr>
<td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
<h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
<!-- To have a header image/logo replace the name below with your img tag -->
<!-- Email clients will render the images when the message is read so any image -->
<!-- must be made available on a public server, so that all recipients can load the image. -->
<a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
getProcess in ProcessInstanceImpl throws a NullPointerException
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/joploya">Sandra Renaud</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/806156#806156">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hello,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I have a NullPointerException when I set process variables and I don't know if it is normal.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The exception comes from this code of jbpm :</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code jive-java">   <font color="darkgreen">//In ProcessInstanceImpl</font>
   <font color="navy"><b>public</b></font> Process getProcess() <font color="navy">{</font>
        <font color="navy"><b>if</b></font> (this.process == <font color="navy"><b>null</b></font>) <font color="navy">{</font>
            this.process = kruntime.getKnowledgeBase().getProcess(processId);
        <font color="navy">}</font>
        <font color="navy"><b>return</b></font> this.process;
    <font color="navy">}</font>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>and this is the StackTrace :</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code">SEVERE [javax.faces.event] (http--127.0.0.1-8080-2) java.lang.NullPointerException
          at org.jbpm.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:68)
          at org.jbpm.process.instance.impl.ProcessInstanceImpl.getContextInstance(ProcessInstanceImpl.java:133)
          at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setVariable(WorkflowProcessInstanceImpl.java:238)
          at com.st.ams.task.management.TaskManager.setProcessVariable(TaskManager.java:234)
          at com.st.ams.task.management.TaskManager$Proxy$_$$_WeldClientProxy.setProcessVariable(TaskManager$Proxy$_$$_WeldClientProxy.java)
          at com.st.ams.form.nfg.jbpm.process.NewFinishedGoodProcessManagement.manageInstanceFgPlanStep2(NewFinishedGoodProcessManagement.java:149)
          at com.st.ams.form.nfg.jbpm.process.NewFinishedGoodProcessManagement.manageInstancePlan(NewFinishedGoodProcessManagement.java:89)
          at com.st.ams.form.nfg.jbpm.process.NewFinishedGoodProcessManagement.manageInstance(NewFinishedGoodProcessManagement.java:71)
          at com.st.ams.form.nfg.jbpm.process.NewFinishedGoodProcessManagement$Proxy$_$$_WeldClientProxy.manageInstance(NewFinishedGoodProcessManagement$Proxy$_$$_WeldClientProxy.java)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)
          at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
          at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
          at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)
          at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170)
          at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:51)
          at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:154)
          at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:241)
          at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:229)
          at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:207)
          at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:569)
          at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:564)
          at org.jboss.weld.event.EventImpl.fire(EventImpl.java:68)
          at com.st.ams.form.bean.EmailBean.send(EmailBean.java:148)
          at com.st.ams.form.bean.EmailBean$Proxy$_$$_WeldClientProxy.send(EmailBean$Proxy$_$$_WeldClientProxy.java)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.apache.el.parser.AstValue.invoke(AstValue.java:262)
          at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
          at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39)
          at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
          at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:153)
          at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
          at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:769)
          at javax.faces.component.UICommand.broadcast(UICommand.java:300)
          at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
          at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
          at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
          at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
          at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
          at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
          at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
          at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:397)
          at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
          at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
          at java.lang.Thread.run(Thread.java:722)
WARN  [org.jboss.solder.exception.control.log] (http--127.0.0.1-8080-2) No handlers found for exception javax.faces.event.AbortProcessingException: java.lang.NullPointerException
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I use persistent session and </p><pre class="jive-pre"><code class="jive-code jive-java">WorkflowProcessInstance wpi = (WorkflowProcessInstance)kSession.getProcessInstance(processInstanceId);
</code></pre><p>return a non null instance.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Regards,</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/806156#806156">going to Community</a></p>
<p style="margin: 0;">Start a new discussion in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>