Bug 1024946 - JAXBException when starting a process with array in parameters via jbpm remote api
Summary: JAXBException when starting a process with array in parameters via jbpm remot...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss BPMS Platform 6
Classification: Retired
Component: Business Central
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ER5
: 6.0.0
Assignee: Marco Rietveld
QA Contact: Ivo Bek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-30 15:47 UTC by Ivo Bek
Modified: 2016-09-20 05:05 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-08-06 20:09:48 UTC
Type: Bug
Embargoed:


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

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


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