ODL Scandium SR1安装restconf/openflow插件遇依赖解析错误求助
ODL Scandium SR1 安装restconf/openflow插件依赖错误解决
问题概述
使用ODL Scandium SR1版本,搭配Java SE 21并配置好环境变量后,安装restconf和openflow插件时出现依赖解析错误,核心报错信息如下:
无法解析根节点:缺少依赖项[root] osgi.identity; osgi.identity=odl-restconf; type=karaf.feature; version="[8.0.3,8.0.3]"; filter="(&(osgi.identity=odl-restconf)(type=karaf.feature)(version>=8.0.3)(version<=8.0.3))" [原因:无法解析odl-restconf/8.0.3:缺少依赖项[odl-restconf/8.0.3] osgi.identity; osgi.identity=odl-restconf-nb; type=karaf.feature; version="[8.0.3,8.0.3]" [原因:无法解析odl-restconf-nb/8.0.3:缺少依赖项[odl-restconf-nb/8.0.3] osgi.identity; osgi.identity=org.opendaylight.netconf.restconf-mdsal-spi; type=osgi.bundle; version="[8.0.3,8.0.3]"; resolution:=mandatory [原因:无法解析org.opendaylight.netconf.restconf-mdsal-spi/8.0.3:缺少依赖项[org.opendaylight.netconf.restconf-mdsal-spi/8.0.3] osgi.wiring.package; filter="(&(osgi.wiring.package=org.opendaylight.mdsal.common.api)(version>=14.0.0)(!(version>=15.0.0)))" [原因:无法解析org.opendaylight.mdsal.mdsal-common-api/14.0.4:缺少依赖项[org.opendaylight.mdsal.mdsal-common-api/14.0.4] osgi.ee; filter="(&(osgi.ee=JavaSE)(version=21))"]]]]
解决步骤
1. 版本兼容性修正
ODL Scandium(8.x系列)官方仅支持Java SE 11,Java 21不在其兼容范围内,这是导致依赖解析失败的核心原因。需切换Java环境至Java 11:
- 下载并安装Java SE 11(OpenJDK或Oracle JDK均可)
- 更新系统环境变量:设置
JAVA_HOME指向Java 11安装目录,调整PATH优先加载Java 11的bin目录 - 执行
java -version验证版本是否为11.x
2. 重新安装插件
切换Java环境后,重启ODL Karaf容器,执行以下命令重新安装插件:
feature:install odl-restconf odl-openflowplugin-all
3. 验证仓库配置(可选)
若仍存在依赖问题,检查Karaf的Maven仓库配置文件etc/org.ops4j.pax.url.mvn.cfg,确保包含ODL官方发布仓库:
org.ops4j.pax.url.mvn.repositories= \ https://repo.opendaylight.org/content/repositories/opendaylight.release@id=opendaylight.release@snapshots, \ https://repo1.maven.org/maven2@id=central
内容的提问来源于stack exchange,提问作者Sourabh Shejwal
相关产品推荐
相关产品推荐

