JBoss Community

Re: jbpm5:Failed to set process variables

created by Tommy Cheng in jBPM - View the full discussion

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

Start a new discussion in jBPM at Community