我按照下面给出的卡拉夫酒窖的例子, http://blog.nanthrax.net/2011/11/apache-karaf-cellar-and-dosgi/
我创建了3个OSGi包,即服务(Bundle1),服务实现(Bundle2)和客户端(Bundle3)。我有2个karaf容器在不同的机器上运行,其中(Bundle1)和(Bundle2)部署在一个karaf实例上,(Bundle1)和(Bundle3)部署在其他karaf实例上。 如示例中给出的那样,每件事情都很好。我从Karaf container2中删除了客户端包,并希望通过蓝图中描述的camel路由调用该服务。
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<reference id="myService" interface="org.service.cellar.EchoService" timeout="20000" availability="optional" />
<camelContext id="camel" trace="false"
xmlns="http://camel.apache.org/schema/blueprint">
<route id="client">
<from uri="timer://foo?fixedRate=true&period=10000" />
<bean ref="myService" method="process" />
<log message=" Invoking Service : ${body}" />
</route>
</camelContext>
</blueprint>
一旦我在karaf container2中部署了上述蓝图,我就在karaf容器中看到以下异常1.我无法找出此错误的来源。任何关于这个问题的评论都表示赞赏。
谢谢。
2012-10-15 13:24:40,477 | ERROR | pool-11-thread-7 | EventDispatchTask | 78 - org.apache.karaf.cellar.core - 2.2.4 | Error while dispatching task java.lang.NullPointerException at org.apache.karaf.cellar.dosgi.RemoteServiceCallHandler.handle(RemoteServiceCallHandler.java:74)[83:org.apache.karaf.cellar.dosgi:2.2.4] at org.apache.karaf.cellar.dosgi.RemoteServiceCallHandler.handle(RemoteServiceCallHandler.java:34)[83:org.apache.karaf.cellar.dosgi:2.2.4] at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_35] at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_35] at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:50)[7:org.apache.aries.proxy:0.3.1] at org.apache.aries.proxy.impl.DefaultWrapper.invoke(DefaultWrapper.java:31)[7:org.apache.aries.proxy:0.3.1] at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:78)[7:org.apache.aries.proxy:0.3.1] at $Proxy24.handle(Unknown Source)[78:org.apache.karaf.cellar.core:2.2.4] at org.apache.karaf.cellar.core.event.EventDispatchTask.run(EventDispatchTask.java:77)[78:org.apache.karaf.cellar.core:2.2.4] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_35] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_35] at java.lang.Thread.run(Thread.java:662)[:1.6.0_35]