Details
Description
I was following this documentation http://camel.apache.org/karaf.html in order to make Camel work in Karaf.
Many tutorials point to this configuration:
@Override public void start(final BundleContext bundleContext) throws Exception { camelContext = new OsgiDefaultCamelContext(bundleContext); registrationCamelContext = bundleContext.registerService(CamelContext.class, camelContext, null); camelContext.start(); }
Unfortunately, when I install Camel in karaf:
karaf@root> feature:repo-add camel 2.23.1
only camel-core can be installed, while camel-core-osgi is missing.
Unfortunately camel-core contains only
DefaultCamelContext
which causes classpath problems in Karaf. For example I import camel-http4, but I get:
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: http4://my.site due to: No component found with scheme: http4
or I import camel-jackson, but I get:
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
The solution is to use:
OsgiDefaultCamelContext
which is located in camel-core-osgi, which is unavailable in Camel Karaf repo.