Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-14656

Unmarshal using ref is not working when upgrading to camel 3.1

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Invalid
    • 3.1.0
    • None
    • camel-xstream
    • None
    • Camel 3.1.0

    • Unknown

    Description

      Hi,

      In Camel we use  route that looks like this:

       

      <route
      ....
      <unmarshal ref="xstream-default" />    <-- This does not work anymore
         <dynamicRouter>        
        <method method="route" ref="dynamicRouter" />    </dynamicRouter>         
      <marshalref="xstream-default" />
      
      ....
      </route>

        

       

      We registered the "xstream-default" in the camel context. 

       

      XStreamDataFormat xD = new XStreamDataFormat();
      xD.setPermissions("*");
      xD.setEncoding("UTF8");
      dataFormats.put("xstream-default", xD);
      
      camelContext.setDataFormats(dataFormats);
      

      and loads the xml using:

       

      try (InputStream is = EventRouteTree.toInputStream(doc)) {
        RoutesDefinition routes = (RoutesDefinition) camelContext.getXMLRoutesDefinitionLoader()
                  .loadRoutesDefinition(camelContext, is);        
      
         routes.getRoutes().forEach(r -> {
                camelContext.addRouteDefinition(r);
      
         });     
       }
      

       

       

      This worked fine i Camel 2.x but doesn't work in Camel 3.1 anymore. Tried to look at the upgrade 2.x to 3.0 guide but I found nothing specific regarding unmarshal. 

      According to the xsd it look like there is no "ref" anymore for the unmarshal defintion .
      https://camel.apache.org/schema/spring/camel-spring-3.1.0.xsd

       

      I get the error when camel tries to start the route.

       

      Caused by: java.lang.IllegalArgumentException: ref or type must be specified at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:152) at org.apache.camel.reifier.dataformat.DataFormatReifier.getDataFormat(DataFormatReifier.java:164)
      

      Which looks strange because the ref is defined in xml tag unmarshal.

      So i guess since the xsd doesn't allow for a ref then the parser ignores the ref and it is empty when the code below is executed. Is this bug or are we suppose to define this in another way in the XML?

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            mattias1972 Mattias Andersson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: