camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Freeman Fang (JIRA)" <>
Subject [jira] [Commented] (CAMEL-12026) ensure camel bundle with spring configuration works in OSGi with aries-blueprint-spring bridge
Date Thu, 22 Feb 2018 06:12:00 GMT


Freeman Fang commented on CAMEL-12026:

Hi [~gnt],

Thanks for looking into this issue.

Please see the reproducer(say-more-spring.tar) I just attached, extract and build it.
Then with a clean Apache Karaf 4.1.3 kit, run commands from karaf console
repo-add camel 2.20.2
feature:install aries-blueprint-spring camel-spring camel-netty-http camel-jackson
bundle:install -s mvn:com.mycompany/say-more-spring/1.0.0-SNAPSHOT

wait a few seconds in the karaf.log we can see the exception like
Caused by: java.lang.IllegalArgumentException: Data format 'json-jackson' could not be created.
Ensure that the data format is valid and the associated Camel component is present on the
	at org.apache.camel.model.DataFormatDefinition.getDataFormat(
	at org.apache.camel.model.DataFormatDefinition.getDataFormat(
	at org.apache.camel.model.UnmarshalDefinition.createProcessor(
	at org.apache.camel.model.ProcessorDefinition.makeProcessorImpl(
	at org.apache.camel.model.ProcessorDefinition.makeProcessor(
	at org.apache.camel.model.ProcessorDefinition.addRoutes( ~[?:?]
	at org.apache.camel.model.RouteDefinition.addRoutes( ~[?:?]
	at org.apache.camel.model.RouteDefinition.addRoutes( ~[?:?]
	at org.apache.camel.impl.DefaultCamelContext.startRoute( ~[?:?]
	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(
	at org.apache.camel.impl.DefaultCamelContext.doStartCamel(
	at org.apache.camel.impl.DefaultCamelContext.access$000( ~[?:?]
	at org.apache.camel.impl.DefaultCamelContext$ ~[?:?]
	at org.apache.camel.impl.DefaultCamelContext$ ~[?:?]
	at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(
	at org.apache.camel.impl.DefaultCamelContext.doStart( ~[?:?]
	at ~[?:?]
	at org.apache.camel.impl.DefaultCamelContext.start( ~[?:?]
	at org.apache.camel.spring.SpringCamelContext.start( ~[?:?]
	... 26 more


IMO this is caused by the camel-spring has no OSGi support so that we cannot use OsgiComponentResolver,
OsgiDataFormatResolver  which are "OSGi aware". 

Btw, my previous suggested fix is [1](this was reverted although it works, and we may need
to use a separate module since it introduce OSGi dependency to camel-spring), which just add
some crucial classes back from the removed camel-spring-dm module.

If we rewrite the reproducer with blueprint, then everything works great. we can send a request
curl -X POST -d "{ \"name\": \"Jack\" }" -H "Content-Type: application/json" http://localhost:10000/say/greeter
and get expected response



> ensure camel bundle with spring configuration works in OSGi with aries-blueprint-spring
> ----------------------------------------------------------------------------------------------
>                 Key: CAMEL-12026
>                 URL:
>             Project: Camel
>          Issue Type: Task
>            Reporter: Freeman Fang
>            Assignee: Guillaume Nodet
>            Priority: Major
>         Attachments: say-more-spring.tar
> the spring-dm won't work with spring 4.x, and there's a new blueprint-spring introduced
in Aries to make the spring configured bundle still work with spring 4.x
> We need add back and which was
removed with camel-spring-dm module, as they are "OSGi context aware" and ensure we use OsgiComponentResolver,
OsgiDataFormatResolver etc with the bundle in OSGi.
> We need remove spring-dm dependency from those classes.

This message was sent by Atlassian JIRA

View raw message