Details
-
Bug
-
Resolution: Done
-
Minor
-
jBPM 6.0.1.Final
-
None
Description
process with variables of primitive types is started and when we try to retrieve this processes variables using the REST API, we have marshalling errors, such as:
16:14:38,054 WARN [org.kie.remote.services.rest.exception.DescriptiveExceptionHandler] (http-localhost.localdomain/127.0.0.1:8080-5) Exception thrown when processing request [/runtime/com.redhat.consulting:TestProj:1.0/process/instance/4/variable/myVar]; responding with status 500: org.kie.remote.services.rest.exception.RestOperationException: Unable to serialize java.lang.String instance because it is missing a javax.xml.bind.annotation.XmlRootElement annotation with a name value.
Endpoint: rest/runtime/PROCESS/process/instance/INSTANCE ID/variable/VAR_NAME
It is not happening with complex types, only with primitive types: boolean, float, integer and String.
Found that the Java implementation of this REST resource always treat the variable as a complex object and try to marshal it:
@GET @Path("/process/instance/{procInstId: [0-9]+}/variable/{varName: [\\w\\.-]+}") public Response process_instance_procInstId_variable_varName(@PathParam("procInstId") Long procInstId, @PathParam("varName") String varName) { Object procVar = processRequestBean.getVariableObjectInstanceFromRuntime(deploymentId, procInstId, varName); // serialize QName rootElementName = getRootElementName(procVar); @SuppressWarnings("rawtypes") // unknown at compile time, dynamic from deployment JAXBElement<?> jaxbElem = new JAXBElement(rootElementName, procVar.getClass(), procVar) ; // return return createCorrectVariant(jaxbElem, headers); }