[
https://issues.apache.org/jira/browse/CAMEL-18225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17558450#comment-17558450
]
Raymond edited comment on CAMEL-18225 at 6/24/22 12:26 PM:
-----------------------------------------------------------
Yes, I found out. Tried both solutions I came up with in my last post. But they
were not working. I got the route in Camel 2 format as input (which I can't
control) so I needed to change it from:
<camelContext xmlns="http://camel.apache.org/schema/spring">
<dataFormats>
<crypto id="myCrypto" algorithm="DES" keyRef="secretKey"/>
</dataFormats>
<route>
<from uri="direct:start"/>
<marshal ref="myCrypto"/>
<to uri="mock:encrypted"/>
<unmarshal ref="myCrypto"/>
<to uri="mock:unencrypted"/>
</route>
</camelContext>
to
<route>
<from uri="direct:start"/>
<marshal ref="myCrypto"/>
<to uri="mock:encrypted"/>
<unmarshal>
<crypto algorithm="DES" keyRef="secretKey"/>
</unmarshal>
<to uri="mock:unencrypted"/>
</route>
or
<route>
<from uri="direct:start"/>
<marshal ref="myCrypto"/>
<to uri="mock:encrypted"/>
<to uri="dataformat:crypto:unmarshal?algorithm=DES&keyRef=secretKey/>
</unmarshal>
<to uri="mock:unencrypted"/>
</route>
This works, but it would be nice to do if by reference and load it centrally
from the routeConfiguration also.
was (Author: skin27):
Yes, I found out. Tried both solutions I came up with in my last post. But they
were not working. I got the route in Camel 2 format as input (which I can't
control) so I needed to change it from:
<camelContext xmlns="http://camel.apache.org/schema/spring">
<dataFormats>
<crypto id="myCrypto" algorithm="DES" keyRef="secretKey"/>
</dataFormats>
<route>
<from uri="direct:start"/>
<marshal ref="myCrypto"/>
<to uri="mock:encrypted"/>
<unmarshal ref="myCrypto"/>
<to uri="mock:unencrypted"/>
</route>
</camelContext>
to
<route>
<from uri="direct:start"/>
<marshal ref="myCrypto"/>
<to uri="mock:encrypted"/>
<unmarshal>
<crypto algorithm="DES" keyRef="secretKey"/>
</unmarshal>
<to uri="mock:unencrypted"/>
</route>
or
<route>
<from uri="direct:start"/>
<marshal ref="myCrypto"/>
<to uri="mock:encrypted"/>
<to uri="dataformat:crypto:unmarshal?algorithm=DES&keyRef=secretKey/>
</unmarshal>
<to uri="mock:unencrypted"/>
</route>
This works, but I would be nice to do if by reference and load it centrally
from the routeConfiguration also.
> Can't load custom dataformat
> ----------------------------
>
> Key: CAMEL-18225
> URL: https://issues.apache.org/jira/browse/CAMEL-18225
> Project: Camel
> Issue Type: Bug
> Affects Versions: 3.14.3
> Environment: Java: JDK 11 (Adoptium Temurin)
> OS: Windows 10
> Reporter: Raymond
> Priority: Minor
>
> I created a custom dataformat and call it with the XML-IO DSL like this:
> <unmarshal>
> <custom ref="myCustomDataformat"/>
> </unmarshal>
> I get the following error:
> org.apache.camel.xml.io.XmlPullParserException: Unexpected element '{}custom'
> According to the XSD I would expect the custom element to be available
> [https://camel.apache.org/schema/spring/camel-spring-3.14.3.xsd]
> Also in Camel in Action2 (page 340) there is an example of this.
>
> I load the XML with the "xml-io" library and "dataformat" is also on the
> classpath.
> On the documentation page:
> [https://camel.apache.org/components/3.14.x/dataformats/index.html]
> The 'custom' dataformat isn't listed however and there is no documentation of
> it. Is it still supported?
> Complete stacktrace:
> org.apache.camel.xml.io.XmlPullParserException: Unexpected element '{}custom'
> at
> org.apache.camel.xml.in.BaseParser.handleUnexpectedElement(BaseParser.java:187)
> at org.apache.camel.xml.in.BaseParser.doParse(BaseParser.java:107)
> at
> org.apache.camel.xml.in.ModelParser.doParseUnmarshalDefinition(ModelParser.java:1449)
> at
> org.apache.camel.xml.in.ModelParser.doParseProcessorDefinitionRef(ModelParser.java:3212)
> at
> org.apache.camel.xml.in.ModelParser.lambda$outputDefinitionElementHandler$4(ModelParser.java:132)
> at
> org.apache.camel.xml.in.ModelParser.lambda$doParseRouteDefinition$71(ModelParser.java:1031)
> at org.apache.camel.xml.in.BaseParser.doParse(BaseParser.java:106)
> at
> org.apache.camel.xml.in.ModelParser.doParseRouteDefinition(ModelParser.java:1005)
> at
> org.apache.camel.xml.in.ModelParser.parseSingleRoutesDefinition(ModelParser.java:1185)
> at
> org.apache.camel.xml.in.ModelParser.parseRoutesDefinition(ModelParser.java:1178)
> at
> org.apache.camel.dsl.xml.io.XmlRoutesBuilderLoader$1.configure(XmlRoutesBuilderLoader.java:78)
> at
> org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:607)
> at
> org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:553)
> at
> org.apache.camel.builder.RouteBuilder.updateRoutesToCamelContext(RouteBuilder.java:515)
> at
> org.apache.camel.spi.RoutesLoader.updateRoutes(RoutesLoader.java:105)
> at
> org.apache.camel.spi.RoutesLoader.updateRoutes(RoutesLoader.java:87)
--
This message was sent by Atlassian Jira
(v8.20.7#820007)