Camel Jackson
cvasilak Jan 9, 2012 10:18 AMHi there,
I am trying to define the following route using camel json unmarshalling.
from("switchyard://RegistrationRoute")
.choice()
.when(header("type").isEqualTo("register"))
.unmarshal().json(JsonLibrary.Jackson, gr.forthnet.nms.svcrrd.service.messages.RegistrationCommandMessage.class)
.bean(Routing.class, "addRouteFromRegistrationCommandMsg(gr.forthnet.nms.svcrrd.service.messages.RegistrationCommandMessage)")
.log("registration completed");
}
When is deployed I get the following message
Failed to create route route1 at: >>> Choice[[When[{header(type) == register} -> [Marshal[org.apache.camel.model.dataformat.JsonDataFormat@3cf720d5], Bean[gr.forthnet.nms.svcrrd.service.singleton.Routing], Log[registration completed]]]]] <<< in route: Route[[From[switchyard://RegistrationRoute?namespace=urn%3As... because of Data format 'json-jackson' could not be created. Ensure that the dataformat is valid and the associated Camel component is present on the classpath
I added a component folder on the modules folder of JBoss As 7
../jboss-as-7.1.0.CR1b/modules/org/apache/camel/component/jackson/main
with the camel-jackson jar files
camel-jackson-2.8.0.jar
module.xml
where on module.xml I added the following:
<module xmlns="urn:jboss:module:1.0" name="org.apache.camel.component.jackson">
<resources>
<resource-root path="camel-jackson-2.8.0.jar"/>
</resources>
<dependencies>
<module name="org.apache.camel.core"/>
<module name="org.apache.camel.spring"/>
<module name="org.apache.commons.logging"/>
<module name="javax.jms.api"/>
<module name="org.springframework"/>
<module name="org.slf4j"/>
<module name="org.codehaus.jackson.jackson-core-asl"/>
<module name="org.codehaus.jackson.jackson-mapper-asl"/>
<module name="org.codehaus.jackson.jackson-xc"/>
</dependencies>
</module>
And then on camel/core/main/module.xml I added my dependency
....
<module name="org.apache.camel.component.jackson"/>
...
Failed to create route route1 at: >>> Choice[[When[{header(type) == register} -> [Marshal[org.apache.camel.model.dataformat.JsonDataFormat@63815614], Bean[gr.forthnet.nms.svcrrd.service.singleton.Routing], Log[registration completed]]]]] <<< in route: Route[[From[switchyard://RegistrationRoute?namespace=urn%3As... because of Data format 'json-jackson' could not be created. Ensure that the dataformat is valid and the associated Camel component is present on the classpath
I would like to ask what is the proper way to install the camel-jackson component?
Regards
Christos