Bug 1024946 - JAXBException when starting a process with array in parameters via jbpm remote api
JAXBException when starting a process with array in parameters via jbpm remot...
Status: CLOSED CURRENTRELEASE
Product: JBoss BPMS Platform 6
Classification: JBoss
Component: Business Central (Show other bugs)
6.0.0
Unspecified Unspecified
high Severity high
: ER5
: 6.0.0
Assigned To: Marco Rietveld
Ivo Bek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-30 11:47 EDT by Ivo Bek
Modified: 2016-09-20 01:05 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-08-06 16:09:48 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
the process definition (6.00 KB, application/xml)
2013-10-30 11:47 EDT, Ivo Bek
no flags Details
stacktrace (4.34 KB, text/plain)
2013-10-30 11:48 EDT, Ivo Bek
no flags Details

  None (edit)
Description Ivo Bek 2013-10-30 11:47:30 EDT
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 11:48:55 EDT
Created attachment 817494 [details]
stacktrace
Comment 3 Marek Baluch 2013-10-31 13:17:56 EDT
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 10:08:04 EDT
Thanks Ivo and Marek.
Comment 7 Marco Rietveld 2013-11-01 10:09:46 EDT
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 10:31:23 EDT
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 08:10:25 EST
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 10:34:48 EST
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 09:17:41 EST
Verified in BPMS 6.0.0.ER5

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

Note You need to log in before you can comment on or make changes to this bug.