Bug 1032639

Summary: There is no way how to define JAXB marshalling for commands In Spring Camel integration
Product: [Retired] JBoss BRMS Platform 6 Reporter: Ivo Bek <ibek>
Component: BREAssignee: Marco Rietveld <mrietvel>
Status: CLOSED CURRENTRELEASE QA Contact: Ivo Bek <ibek>
Severity: medium Docs Contact:
Priority: high    
Version: 6.0.0CC: ibek, kverlaen, smcgowan
Target Milestone: ER6   
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:19:06 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:
Embargoed:

Description Ivo Bek 2013-11-20 14:10:17 UTC
Description of problem:

I have following REST server:

<cxf:rsServer
    id="rsJaxbServer"
    address="http://localhost:58003/restjaxb"
    serviceClass="org.kie.jax.rs.CommandExecutorImpl">
    <cxf:providers>
      <bean class="org.kie.jax.rs.CommandMessageBodyReader" />
    </cxf:providers>
  </cxf:rsServer>

for that I've created this camel route:

<route id="restJaxbGW">
  <from uri="cxfrs://bean://rsJaxbServer"/>
  <policy ref="kiePolicy">
    <unmarshal ref="jaxb" /> // here is the problem
    <to uri="kie:ksession1"/>
    <marshal ref="jaxb" />
   </policy>
</route>

The source code of KiePolicy counts on the jaxb. https://github.com/droolsjbpm/droolsjbpm-integration/blob/master/kie-camel/src/main/java/org/kie/camel/component/KiePolicy.java#L154

When I run any request, I receive:

javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "null" doesnt contain ObjectFactory.class or jaxb.index

this is obvious because I should define something like:

<dataFormats>
  <jaxb id="jaxbCommands" prettyPrint="true" contextPath="org.drools.core.command"/>
</dataFormats>

but in the package "org.drools.core.command" there must be the jaxb.index or ObjectFactory as I understand. There should be the same classes as defined here https://github.com/droolsjbpm/droolsjbpm-integration/blob/6.0.x/kie-remote/kie-services-client/src/main/java/org/kie/services/client/serialization/jaxb/impl/JaxbCommandsRequest.java

It might be possible to have the classes just in the jaxb.index.

Comment 3 Ivo Bek 2013-11-20 14:19:06 UTC
Actually it should be enough to have just the supported commands for Spring Camel integration in the jaxb.index somewhere.

Comment 7 Marco Rietveld 2013-12-06 14:20:02 UTC
This problem has been fixed. However, I'm not completely sure that all JAXB problems with spring/camel integration have been fixed. 

Ivo, please keep up the good work and feel free to file more bugs dealing with these tests if the test still doesn't (completely) succeed after this fix. Running the tests locally, they all succeed except for zLastTestGlobalVariable(), but that seems to be caused by something else. 

6.0.x: 
https://github.com/droolsjbpm/droolsjbpm-integration/commit/5fde4655ea87081d001faf1795bb779e0d2d9d75

master: 
https://github.com/droolsjbpm/droolsjbpm-integration/commit/9c6ed726c38ffc9c45915f3d2f33000d26fae45b

Comment 8 Ivo Bek 2013-12-06 14:49:18 UTC
Perfect, I'll look at it when we have a new build. The zLastTestGlobalVariable() test works with xstream, so it's interesting that it fails. I'd say it's because I send there more then one commands in one request but this is not the only test where I send more then one commands in one request, so it must be something different.

Comment 9 Ivo Bek 2014-01-08 15:38:36 UTC
Verified in BPMS 6.0.0.ER7

The tests which did not work in JAXB were caused by own types. For this problem I filed BZ 1049979