Missing Dependency for OpenDaylight controller app (Sodium SR1)

蓝咒 提交于 2020-05-14 05:01:28

问题


I am following the instructions here to write an simple hello world RPC: https://docs.opendaylight.org/en/stable-sodium/developer-guide/developing-apps-on-the-opendaylight-controller.html

In the example HelloProvider class, the constructor is:

 public HelloProvider(final DataBroker dataBroker, final RpcProviderService rpcProviderService) {
     this.dataBroker = dataBroker;
     this.rpcProviderService = rpcProviderService;
 }

which requires a RpcProviderService, therefore the compilation fails. So I added to impl/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml:

      <reference id="rpcProviderService"
         interface="org.opendaylight.mdsal.binding.api.RpcProviderService"/>
         odl:type="default" />

That leads to the project compiling, but fails at the test phase:

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) 

The org.opendaylight.controller package is already pulled in, so perhaps I am missing something else. Any advice?


回答1:


I was also facing the same issue. I modified the impl-blueprint.xml as follows:

<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>

After this, I faced another issue while accessing the REST API through HTTP method. I was getting Error 401 - unauthorized. For this, I installed odl-mdsal-apidocs and it started working.

<dependency>
  <groupId>org.opendaylight.netconf</groupId>
  <artifactId>odl-mdsal-apidocs</artifactId>
  <version>1.10.2</version>
  <type>xml</type>
  <classifier>features</classifier>
</dependency>


来源:https://stackoverflow.com/questions/59674296/missing-dependency-for-opendaylight-controller-app-sodium-sr1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!