Hi,
I have problems using a OSGI-Service/bundle in a camel route. Read
tutorial-osgi-camel but didn't get it to work.
The setup:
bundle 1 defines a Service interface (separate bundle for interface
because there can be several implementations of it)
bundle 2 implements this interface
bundle 3 should use bundle 2 that provides interface from bundle 1
In bundle 2 (the implementation) are the two xmls, one with
<osgi:service ref="invokeService">
<osgi:interfaces>
<value>invoker.Invoker</value>
</osgi:interfaces>
</osgi:service>
and the other with
<bean id="invokeService" class="invokerImpl.InvokerImpl">
</bean>
Bundle 3 has a xml file with
<osgi:reference id="invokeService" interface="invoker.Invoker"/>
in it. Bundle 3 and the CamelContext is started with
@Override
public void start(BundleContext bundleContext) throws Exception {
OsgiDefaultCamelContext camelContext = new
OsgiDefaultCamelContext(bundleContext);
camelContext.addRoutes(new ExampleRoute());
camelContext.start();
}
In my route I want to use the Service (from bundle 2) with
.to("bean:invokeService")
Exceptions I get:
19:14:39.953 TRACE o.a.camel.core.osgi.OsgiClassResolver:42 Resolve
class invokeService
19:14:39.969 TRACE o.a.camel.core.osgi.OsgiClassResolver:84 Cannot
load class: invokeService using classloader:
CamleOSGIExample_1.0.0.qualifier [254]. This exception be ignored.
java.lang.ClassNotFoundException: invokeService
at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
~[na:na]
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
~[na:na]
(...)
and
org.apache.camel.NoSuchBeanException: No bean could be found in the registry
for: invokeService
at
org.apache.camel.component.bean.RegistryBean.getBean(RegistryBean.java:68)
~[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:83)
~[camel-core-2.10.3.jar:2.10.3]
I'm using Equinox. From reading I know that karaf would be the better
choice, but unfortunately this isn't my decision.
Thanks in advance.
--
View this message in context:
http://camel.465427.n5.nabble.com/Problems-using-a-osgi-bundle-in-a-camel-route-tp5728064.html
Sent from the Camel - Users mailing list archive at Nabble.com.