1
我有在OSGi声明性服务组件不满意的基准的问题:不合格参考
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
name="com.mycompany.foo.Service"
immediate="true"
activate="activate"
deactivate="deactivate">
<implementation class="com.mycompany.foo.Service"/>
<!-- Other references -->
<reference
interface="org.osgi.service.http.HttpService"
name="HttpService"
cardinality="1..1"
policy="static"
bind="setHttpService"
unbind="unsetHttpService"/>
</scr:component>
我启动Eclipse中的OSGi应用程序,并且控制台显示服务处于Unsatisfied
状态:
osgi> ls
All Components:
ID State Component Name Located in bundle
6 Unsatisfied com.mycompany.foo.Service com.mycompany.foo(bid=18)
的comp
命令报告的理由是不满意的参照org.osgi.service.http
:
osgi> comp 6
Component[
name = com.mycompany.foo.Service
...
state = Unsatisfied
references = {
...
Reference[name = HttpService, interface = org.osgi.service.http.HttpService, policy = static, cardinality = 1..1, target = null, bind = setHttpService, unbind = unsetHttpService]
}
located in bundle = com.mycompany.foo_1.2.3 [18]
]
Dynamic information :
*The component is NOT satisfied
The following references are not satisfied:
Reference[name = HttpService, interface = org.osgi.service.http.HttpService, policy = static, cardinality = 1..1, target = null, bind = setHttpService, unbind = unsetHttpService]
Component configurations :
Configuration properties:
component.name = com.mycompany.foo.Service
component.id = 6
Instances:
但是org.osgi.service.http
可用作packages
命令显示:
osgi> p org.osgi.service.http
org.osgi.service.http; version="1.2.1"<org.eclipse.osgi.services_3.2.100.v20100503 [54]>
com.mycompany.foo_1.2.3 [18] imports
org.eclipse.equinox.http.registry_1.1.1.R36x_v20101103 [46] imports
org.eclipse.equinox.http.servlet_1.1.0.v20100503 [47] imports
org.eclipse.equinox.http.servletbridge_1.0.200.v20100503 [48] imports
我试图消除从服务文件基准和服务组件被实例化并正确激活,但没有本质HttpService
片。
任何帮助进一步排除故障非常感谢。
谢谢尼尔,我现在就试试。该实现应该通过'org.eclipse.equinox.http.servlet.internal.HttpServiceImpl'提供。 – claudiopro
这是一个捆绑中私有的类的名称。你不需要关心这一点 - 你只关心哪个软件包提供服务。 –
原来在我的工作区中丢失了捆绑包。我的项目需要从更广泛的软件包库中挑选最小集合。目标平台需要比我最初选择的捆绑更多的捆绑。我猜在这种情况下没有运行时错误是由设计决定的? – claudiopro