我有一个 OSGi 服务,我在 jboss fuse fabric 上公开并部署了它。现在我需要从部署在 jboss fuse fabric 中另一个容器上的另一个包访问此服务。但在客户端容器中无法访问该服务。jboss fuse V6.3
当我在 fuse Fabric 的同一个容器中部署 OSGi 服务包和客户端包时,它可以工作,但是当我在不同的容器中部署它们时不起作用并显示错误:无法启动包 com.osgi.app 的蓝图容器.bean-camel-client10/1.0.0 由于未解决的依赖关系 [(objectClass=org.fusesource.example.service.HelloWorldSvc)]
在客户端:
POM.xml:
<dependency>
<groupId>com.osgi.app</groupId>
<artifactId>bean-app-service1</artifactId>
<version>1.0</version>
</dependency>
配置.xml:
<reference id="helloWorld"
interface="org.fusesource.example.service.HelloWorldSvc"/>
<camelContext xmlns="http://camel.apache.org/schema/blueprint" >
<route>
<from uri="timer:foo?period=5000"/>
<to uri="bean:org.fusesource.example.service.HelloWorldSvc?method=sayHello"/>
<log message="The message contains: ${body}"/>
</route>
在服务提供商中:
pom.xml:
<groupId>com.osgi.app</groupId>
<artifactId>bean-app-service2</artifactId>
<version>1.0</version>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${version.maven-bundle-plugin}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-SymbolicName>
<Export-Package>org.fusesource.example.service</Export-Package>
</instructions>
</configuration>
</plugin>
配置.xml:
<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
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<bean id="hello" class="org.fusesource.example.service.impl.HelloWorldSvcImpl"/>
<service ref="hello" interface="org.fusesource.example.service.HelloWorldSvc"/>
</blueprint>
如何通过骆驼上下文访问部署在 fuse Fabric 中另一个容器中的服务?