Created attachment 817492 [details] the process definition Description of problem: I have a process with process variable of type Object and I set it to an array when I start the process. The StartCommand seems that cannot be marshalled because of the array in the parameters map; it produces javax.xml.bind.JAXBException: class [Ljava.lang.Float; nor any of its super class is known to this context.] Here is the client calling http://pastebin.com/6927KDxf and the process definition is attached
Created attachment 817494 [details] stacktrace
Source-code-snipp how to reproduce: Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("url", "http://soaptest.parasoft.com/calculator.wsdl"); parameters.put("namespace", "http://www.parasoft.com/wsdl/calculator/"); parameters.put("interface", "Calculator"); parameters.put("operation", "add"); parameters.put("parameters", new Float[]{9.0f, 12.0f}); ProcessInstance pi = rc.startProcess(WEB_SERVICE_WORK_ITEM_PROCESS_ID, parameters); System.out.println(((WorkflowProcessInstance)pi).getVariable("result"));
Thanks Ivo and Marek.
I see this more as a missing feature than as a bug: the problem is that I haven't documented or otherwise specified that the Remote api only accepts serializable parameters, which primitive arrays are not. I'm fairly sure that one easy way to get around this issue is to use a List instead of a primitive array, although I haven't confirmed that.
Hi Marco, I'm sorry but I cannot agree with you that the primitive arrays are not serializable. To support my statement, try the following code: public static void main(String[] args) { Object o = new Float[]{9.0f, 12.0f}; System.out.println("Is a primitive array serializable? " + ((o instanceof Serializable)?"yes":"no")); // prints yes } I strongly believe then, this is a bug, so I wouldn't use List as the only solution.
I have a similar issue when I use StartProcessCommand: Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("url", "http://soaptest.parasoft.com/calculator.wsdl"); parameters.put("namespace", "http://www.parasoft.com/wsdl/calculator/"); parameters.put("interface", "Calculator"); parameters.put("operation", "add"); parameters.put("parameters", new Float[]{9.0f, 12.0f}); rc.executeCommand(DEPLOYMENT_ID, new StartProcessCommand(WEB_SERVICE_WORK_ITEM_PROCESS_ID, parameters)); testWebServiceWorkItem(org.jboss.qa.bpms.jbpm.integration.remote.WorkItemHandlerTest) Time elapsed: 0.437 sec <<< ERROR! javax.xml.bind.MarshalException: null at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:588) ....... javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:116) at org.kie.services.client.serialization.jaxb.JaxbSerializationProvider.convertJaxbObjectToString(JaxbSerializationProvider.java:38) at org.jboss.qa.bpms.jbpm.integration.remote.RestController.executeCommand(RestController.java:342) at org.jboss.qa.bpms.jbpm.integration.remote.RestController.executeCommand(RestController.java:333) at org.jboss.qa.bpms.jbpm.integration.remote.WorkItemHandlerTest.testWebServiceWorkItem(WorkItemHandlerTest.java:35)
The error is gone when I add Float[].class to JAXBContext. So you can add the array types to the JaxbSerializationProvider classes or make it customizable (BZ 1026355, BZ 1026402).
Fixed: 6.0.x: https://github.com/droolsjbpm/droolsjbpm-integration/commit/c2fd03a895ca1b6f16b354a51463c8ba78f9d673 master: https://github.com/droolsjbpm/droolsjbpm-integration/commit/172991ed76f0eb434f6a6bfcebb4d18700565cd2
Verified in BPMS 6.0.0.ER5 note: the given reproducer still doesn't work due to BZ 1026384