[jira] [Commented] (CAMEL-14656) Unmarshal using ref is not working when upgrading to camel 3.1
[ https://issues.apache.org/jira/browse/CAMEL-14656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17051294#comment-17051294 ] Mattias Andersson commented on CAMEL-14656: --- Thanks for your help. Worked perfectly. I'll close this issue. > Unmarshal using ref is not working when upgrading to camel 3.1 > -- > > Key: CAMEL-14656 > URL: https://issues.apache.org/jira/browse/CAMEL-14656 > Project: Camel > Issue Type: Bug > Components: camel-xstream >Affects Versions: 3.1.0 > Environment: Camel 3.1.0 >Reporter: Mattias Andersson >Priority: Critical > > Hi, > In Camel we use route that looks like this: > > {code:java} > > <-- This does not work anymore > > > > > {code} > > > We registered the "xstream-default" in the camel context. > > {code:java} > XStreamDataFormat xD = new XStreamDataFormat(); > xD.setPermissions("*"); > xD.setEncoding("UTF8"); > dataFormats.put("xstream-default", xD); > {code} > {code:java} > camelContext.setDataFormats(dataFormats); > {code} > and loads the xml using: > > {code:java} > try (InputStream is = EventRouteTree.toInputStream(doc)) { > RoutesDefinition routes = (RoutesDefinition) > camelContext.getXMLRoutesDefinitionLoader() > .loadRoutesDefinition(camelContext, is); >routes.getRoutes().forEach(r -> { > camelContext.addRouteDefinition(r); >}); > } > {code} > > > 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. > > {code:java} > 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) > {code} > 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? > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (CAMEL-14656) Unmarshal using ref is not working when upgrading to camel 3.1
[ https://issues.apache.org/jira/browse/CAMEL-14656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17051245#comment-17051245 ] Guillaume Nodet commented on CAMEL-14656: - The syntax with the {{ref}} attribute was deprecated. You should now use {{}} > Unmarshal using ref is not working when upgrading to camel 3.1 > -- > > Key: CAMEL-14656 > URL: https://issues.apache.org/jira/browse/CAMEL-14656 > Project: Camel > Issue Type: Bug > Components: camel-xstream >Affects Versions: 3.1.0 > Environment: Camel 3.1.0 >Reporter: Mattias Andersson >Priority: Critical > > Hi, > In Camel we use route that looks like this: > > {code:java} > > <-- This does not work anymore > > > > > {code} > > > We registered the "xstream-default" in the camel context. > > {code:java} > XStreamDataFormat xD = new XStreamDataFormat(); > xD.setPermissions("*"); > xD.setEncoding("UTF8"); > dataFormats.put("xstream-default", xD); > {code} > {code:java} > camelContext.setDataFormats(dataFormats); > {code} > and loads the xml using: > > {code:java} > try (InputStream is = EventRouteTree.toInputStream(doc)) { > RoutesDefinition routes = (RoutesDefinition) > camelContext.getXMLRoutesDefinitionLoader() > .loadRoutesDefinition(camelContext, is); >routes.getRoutes().forEach(r -> { > camelContext.addRouteDefinition(r); >}); > } > {code} > > > 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. > > {code:java} > 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) > {code} > 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? > -- This message was sent by Atlassian Jira (v8.3.4#803005)