Reputation: 97
I have problems using a OSGI-Service in a camel route. Read tutorial-osgi-camel-part1 but didn't get it to work.
The setup:
In bundle 2 (the implementation) are the two xml files, 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")
Exception 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.
Upvotes: 3
Views: 3787