<!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="http://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;">
jbpm5:Failed to set process variables
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/timerule">jack pan</a> in <i>jBPM</i> - <a href="http://community.jboss.org/docs/DOC-16912">View the full document</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p><span style="font-size: 24px; font-family: arial, sans-serif;"><span style="text-indent: 0px; color: #000000; font-size: 24px; font-family: arial, sans-serif;"><span class="hps" title="点击可显示其他翻译">Customize</span><span class="Apple-converted-space"> </span><span class="hps" title="点击可显示其他翻译">rest</span><span class="Apple-converted-space"> </span><span class="hps" title="点击可显示其他翻译">method in</span><span class="Apple-converted-space"> </span><span class="hps" title="点击可显示其他翻译">gwt-console-server.war:</span></span></span> </p><pre class="jive-pre"><code class="jive-code jive-java">@PUT
@Path(<font color="red">"instance/{id}/addInstanceData"</font>)
@Consumes(<font color="red">"multipart/form-data"</font>)
<font color="navy"><b>public</b></font> Response addInstanceData(
@PathParam(<font color="red">"id"</font>)
String instanceId,
Map<String, String> processVars)<font color="navy">{</font>
  <font color="navy"><b>try</b></font> <font color="navy">{</font>
   Map<String,Object> params = <font color="navy"><b>new</b></font> HashMap<String, Object>();
   params.put(<font color="red">"testkey"</font>, <font color="red">"testValue"</font>);
  
   getProcessManagement().setInstanceData(instanceId, params);
   <font color="navy"><b>return</b></font> Response.ok().build();
  <font color="navy">}</font> <font color="navy"><b>catch</b></font> (Throwable t) <font color="navy">{</font>
   <font color="navy"><b>throw</b></font> <font color="navy"><b>new</b></font> WebApplicationException(t, 500);
  <font color="navy">}</font>
<font color="navy">}</font>
 
<font color="navy"><b>private</b></font> ProcessManagement getProcessManagement() <font color="navy">{</font>
  <font color="navy"><b>if</b></font> (<font color="navy"><b>null</b></font> == this.processManagement) <font color="navy">{</font>
   ManagementFactory factory = ManagementFactory.newInstance();
   this.processManagement = factory.createProcessManagement();
   log.debug(<font color="red">"Using ManagementFactory impl:"</font>
     + factory.getClass().getName());
  <font color="navy">}</font>
  <font color="navy"><b>return</b></font> this.processManagement;
<font color="navy">}</font>
 
</code></pre><p><span style="text-indent: 0px; color: #000000; font-size: 24px; font-family: arial, sans-serif;"><span class="hps" title="点击可显示其他翻译">Throws</span><span class="Apple-converted-space"> </span><span class="hps" title="点击可显示其他翻译">the following error:</span></span></p><pre class="jive-pre"><code class="jive-code jive-java">2011-06-13 20:17:35,468 INFO  [STDOUT] (http-0.0.0.0-8080-4) Hibernate: select processins0_.InstanceId as InstanceId54_0_, processins0_.lastModificationDate as lastModi2_54_0_, processins0_.lastReadDate as lastRead3_54_0_, processins0_.processId as processId54_0_, processins0_.processInstanceByteArray as processI5_54_0_, processins0_.startDate as startDate54_0_, processins0_.state as state54_0_, processins0_.OPTLOCK as OPTLOCK54_0_ from ProcessInstanceInfo processins0_ where processins0_.InstanceId=?
2011-06-13 20:17:35,484 INFO  [STDOUT] (http-0.0.0.0-8080-4) Hibernate: update ProcessInstanceInfo set lastModificationDate=?, lastReadDate=?, processId=?, processInstanceByteArray=?, startDate=?, state=?, OPTLOCK=? where InstanceId=? and OPTLOCK=?
2011-06-13 20:17:35,500 INFO  [STDOUT] (http-0.0.0.0-8080-4) 20:17:35,484 ERROR [SynchronousDispatcher] failed to execute
javax.ws.rs.WebApplicationException: java.lang.NullPointerException
at org.jboss.bpm.console.server.CustomFacade.addInstanceData(CustomFacade.java:92)
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:597)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:117)
at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:260)
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:232)
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:166)
at org.jboss.resteasy.core.DispatcherUtilities.getJaxrsResponse(DispatcherUtilities.java:142)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
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:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
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:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
at org.jbpm.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:67)
at org.jbpm.process.instance.impl.ProcessInstanceImpl.getContextInstance(ProcessInstanceImpl.java:127)
at org.jbpm.integration.console.CommandDelegate.setProcessInstanceVariables(CommandDelegate.java:270)
at org.jbpm.integration.console.ProcessManagement.setInstanceData(ProcessManagement.java:96)
at org.jboss.bpm.console.server.CustomFacade.addInstanceData(CustomFacade.java:88)
... 38 more
 
</code></pre><p>Any idea anyone?</p><p>Thanks</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Comment by <a href="http://community.jboss.org/docs/DOC-16912">going to Community</a></p>
        <p style="margin: 0;">Create a new document in jBPM at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2034">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>