缺少 OpenDaylight 控制器应用程序 (Sodium SR1) 的依赖项
Missing Dependency for OpenDaylight controller app (Sodium SR1)
我正在按照此处的说明编写一个简单的 hello world RPC:https://docs.opendaylight.org/en/stable-sodium/developer-guide/developing-apps-on-the-opendaylight-controller.html
在示例 HelloProvider class 中,构造函数是:
public HelloProvider(final DataBroker dataBroker, final RpcProviderService rpcProviderService) {
this.dataBroker = dataBroker;
this.rpcProviderService = rpcProviderService;
}
需要RpcProviderService,所以编译失败。所以我添加到 impl/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml:
<reference id="rpcProviderService"
interface="org.opendaylight.mdsal.binding.api.RpcProviderService"/>
odl:type="default" />
这导致项目编译,但在测试阶段失败:
Missing dependencies:
(objectClass=org.opendaylight.controller.md.sal.dom.api.DOMNotificationPublishService)
(objectClass=org.opendaylight.controller.md.sal.dom.api.DOMDataBroker)
(objectClass=org.opendaylight.controller.md.sal.dom.spi.DOMNotificationSubscriptionListenerRegistry)
(objectClass=org.opendaylight.controller.md.sal.dom.api.DOMMountPointService)
(objectClass=org.opendaylight.controller.md.sal.dom.api.DOMRpcService)
(objectClass=org.opendaylight.controller.md.sal.dom.api.DOMNotificationService)
(objectClass=org.opendaylight.controller.md.sal.dom.api.DOMDataBroker)
(objectClass=org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService)
org.opendaylight.controller 包已经被引入,所以我可能还遗漏了其他东西。有什么建议吗?
我也遇到了同样的问题。我修改了 impl-blueprint.xml 如下:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
odl:use-default-for-reference-types="true">
<reference id="dataBroker"
interface="org.opendaylight.mdsal.binding.api.DataBroker"
odl:type="default" />
<reference id="rpcProviderService"
interface="org.opendaylight.mdsal.binding.api.RpcProviderService"
odl:type="default" />
<bean id="provider"
class="org.opendaylight.hello.impl.HelloProvider"
init-method="init" destroy-method="close">
<argument ref="dataBroker" />
<argument ref="rpcProviderService" />
</bean>
在此之后,我在通过 HTTP 方法访问 REST API 时遇到了另一个问题。我收到错误 401 - 未经授权。为此,我安装了 odl-mdsal-apidocs 并开始工作。
<dependency>
<groupId>org.opendaylight.netconf</groupId>
<artifactId>odl-mdsal-apidocs</artifactId>
<version>1.10.2</version>
<type>xml</type>
<classifier>features</classifier>
</dependency>
我正在按照此处的说明编写一个简单的 hello world RPC:https://docs.opendaylight.org/en/stable-sodium/developer-guide/developing-apps-on-the-opendaylight-controller.html
在示例 HelloProvider class 中,构造函数是:
public HelloProvider(final DataBroker dataBroker, final RpcProviderService rpcProviderService) {
this.dataBroker = dataBroker;
this.rpcProviderService = rpcProviderService;
}
需要RpcProviderService,所以编译失败。所以我添加到 impl/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml:
<reference id="rpcProviderService"
interface="org.opendaylight.mdsal.binding.api.RpcProviderService"/>
odl:type="default" />
这导致项目编译,但在测试阶段失败:
Missing dependencies:
(objectClass=org.opendaylight.controller.md.sal.dom.api.DOMNotificationPublishService)
(objectClass=org.opendaylight.controller.md.sal.dom.api.DOMDataBroker)
(objectClass=org.opendaylight.controller.md.sal.dom.spi.DOMNotificationSubscriptionListenerRegistry)
(objectClass=org.opendaylight.controller.md.sal.dom.api.DOMMountPointService)
(objectClass=org.opendaylight.controller.md.sal.dom.api.DOMRpcService)
(objectClass=org.opendaylight.controller.md.sal.dom.api.DOMNotificationService)
(objectClass=org.opendaylight.controller.md.sal.dom.api.DOMDataBroker)
(objectClass=org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService)
org.opendaylight.controller 包已经被引入,所以我可能还遗漏了其他东西。有什么建议吗?
我也遇到了同样的问题。我修改了 impl-blueprint.xml 如下:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
odl:use-default-for-reference-types="true">
<reference id="dataBroker"
interface="org.opendaylight.mdsal.binding.api.DataBroker"
odl:type="default" />
<reference id="rpcProviderService"
interface="org.opendaylight.mdsal.binding.api.RpcProviderService"
odl:type="default" />
<bean id="provider"
class="org.opendaylight.hello.impl.HelloProvider"
init-method="init" destroy-method="close">
<argument ref="dataBroker" />
<argument ref="rpcProviderService" />
</bean>
在此之后,我在通过 HTTP 方法访问 REST API 时遇到了另一个问题。我收到错误 401 - 未经授权。为此,我安装了 odl-mdsal-apidocs 并开始工作。
<dependency>
<groupId>org.opendaylight.netconf</groupId>
<artifactId>odl-mdsal-apidocs</artifactId>
<version>1.10.2</version>
<type>xml</type>
<classifier>features</classifier>
</dependency>