[ https://issues.apache.org/jira/browse/CAMEL-12026?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16372453#comment-16372453 ]
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 {code} 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 {code} wait a few seconds in the karaf.log we can see the exception like {code} 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 classpath at org.apache.camel.model.DataFormatDefinition.getDataFormat(DataFormatDefinition.java:118) ~[?:?] at org.apache.camel.model.DataFormatDefinition.getDataFormat(DataFormatDefinition.java:91) ~[?:?] at org.apache.camel.model.UnmarshalDefinition.createProcessor(UnmarshalDefinition.java:189) ~[?:?] at org.apache.camel.model.ProcessorDefinition.makeProcessorImpl(ProcessorDefinition.java:549) ~[?:?] at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:510) ~[?:?] at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:226) ~[?:?] at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1295) ~[?:?] at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:204) ~[?:?] at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:1148) ~[?:?] at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3727) ~[?:?] at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3441) ~[?:?] at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:208) ~[?:?] at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3249) ~[?:?] at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3245) ~[?:?] at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3268) ~[?:?] at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3245) ~[?:?] at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) ~[?:?] at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3168) ~[?:?] at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133) ~[?:?] ... 26 more {code} 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 {code} curl -X POST -d "{ \"name\": \"Jack\" }" -H "Content-Type: application/json" http://localhost:10000/say/greeter {code} and get expected response {code} {"response":"SUCCESS","errors":["warn1","warn2"]} {code} Freeman [1]https://github.com/apache/camel/commit/ba21445a2548946871ddd3ee2007c4659dbed223 > ensure camel bundle with spring configuration works in OSGi with > aries-blueprint-spring bridge > ---------------------------------------------------------------------------------------------- > > Key: CAMEL-12026 > URL: https://issues.apache.org/jira/browse/CAMEL-12026 > 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 CamelContextFactoryBean.java and OsgiSpringCamelContext.java > 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 (v7.6.3#76005)