[jboss-user] [jBPM] - Re: jbpm5:Failed to set process variables

Tommy Cheng do-not-reply at jboss.com
Thu Aug 11 00:02:06 EDT 2011


Tommy Cheng [http://community.jboss.org/people/tomcheng76] created the discussion

"Re: jbpm5:Failed to set process variables"

To view the discussion, visit: http://community.jboss.org/message/620497#620497

--------------------------------------------------------------
Same here.

After tracing the code, i found that the kruntime changed to null suddenly...

kruntime is set previously. but it changed to null when calling getProcess()

To test it: 

Add the following to org.jboss.bpm.console.server.ProcessMgmtFacade.java in jbpm-gwt-console-server
  @POST
  @Consumes("multipart/form-data")
  @Path("instance/{id}/data")
  public Response setInstanceData(
                      @Context
                      HttpServletRequest request,
                      @PathParam("id")
                      String instanceId
  )
  {


            try {
                ServletFileUpload upload = new ServletFileUpload();
                FileItemIterator fileIterator = upload.getItemIterator(request);
                while (fileIterator.hasNext()) {
                    FileItemStream item = fileIterator.next();
                    log.info("Setting Process instance data: Content-Type: " + item.getContentType() + " Name: " + item.getFieldName());
                    Map<String, Object> data = new HashMap<String, Object>();

                    if (item.getContentType() == null){
                        String s = IOUtils.toString(item.openStream());
                        data.put(item.getFieldName(), s);
                    } else {
                              File f = File.createTempFile("file-", "");
                        IOUtils.copy(item.openStream(), new FileOutputStream(f));
                        data.put(item.getFieldName(), f.getCanonicalPath());
                    }
                    getProcessManagement().setInstanceData(instanceId, data);
                }
            } catch (Exception e) {
          log.info("cannot set instance data", e);
            }
      ProcessInstanceRef instance = getProcessManagement().getProcessInstance(instanceId);
      return createJsonResponse(instance);
  }


then post something to gwt-console-server/rs/process/instance/{yourinstanceid}/data

NullPointerException @ setInstanceData
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/620497#620497]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110811/8ea2e421/attachment.html 


More information about the jboss-user mailing list