Bug 1024946

Summary: JAXBException when starting a process with array in parameters via jbpm remote api
Product: [Retired] JBoss BPMS Platform 6 Reporter: Ivo Bek <ibek>
Component: Business CentralAssignee: Marco Rietveld <mrietvel>
Status: CLOSED CURRENTRELEASE QA Contact: Ivo Bek <ibek>
Severity: high Docs Contact:
Priority: high    
Version: 6.0.0CC: kverlaen, mbaluch, rrajasek, smcgowan
Target Milestone: ER5   
Target Release: 6.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 20:09:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
the process definition
none
stacktrace none

Description Ivo Bek 2013-10-30 15:47:30 UTC
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

Comment 1 Ivo Bek 2013-10-30 15:48:55 UTC
Created attachment 817494 [details]
stacktrace

Comment 3 Marek Baluch 2013-10-31 17:17:56 UTC
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"));

Comment 6 Marco Rietveld 2013-11-01 14:08:04 UTC
Thanks Ivo and Marek.

Comment 7 Marco Rietveld 2013-11-01 14:09:46 UTC
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.

Comment 8 Ivo Bek 2013-11-01 14:31:23 UTC
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.

Comment 9 Ivo Bek 2013-11-04 13:10:25 UTC
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)

Comment 10 Ivo Bek 2013-11-04 15:34:48 UTC
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).

Comment 12 Ivo Bek 2013-11-29 14:17:41 UTC
Verified in BPMS 6.0.0.ER5

note: the given reproducer still doesn't work due to BZ 1026384