opendaylight 在windows serverR2下启动运行报错

时间:2024-05-20 11:48:27

在开发时opendaylight在windows7下使用,都能正常使用,没有问题,但现在需要将opendaylight放到windows server2012 R2下运行,结果发现运行报错,寻找了很多方式,现在将解决方法分享,希望后来者不再浪费时间。

错误1:java.lang.NoClassDefFoundError: org/fusesource/leveldbjni/JniDBFactory at akka.persistence.journal.leveldb. LeveldbStore$class.leveldbFactory(LeveldbStore.scala:52)

opendaylight 启动karaf 错误信息如下:

Uncaught error from thread [opendaylight-cluster-data-akka.persistence.dispatchers.default-plugin-dispatcher-21]:
org/fusesource/leveldbjni/JniDBFactory, shuttingg down JVM since
‘akka.jvm-exit-on-fatal-error’ is enabled for for ActorSystem[opendaylight-cluster-data]
java.lang.NoClassDefFoundError: org/fusesource/leveldbjni/JniDBFactory
at akka.persistence.journal.leveldb.LeveldbStoreclass.leveldbFactory(LeveldbStore.scala:52)atakka.persistence.journal.leveldb.LeveldbJournal.leveldbFactory(LeveldbJournal.scala:23)atakka.persistence.journal.leveldb.LeveldbStoreclass.leveldbFactory(LeveldbStore.scala:52) at akka.persistence.journal.leveldb.LeveldbJournal.leveldbFactory(LeveldbJournal.scala:23) at akka.persistence.journal.leveldb.LeveldbStoreclass.preStart(LeveldbStore.scala:178)
at akka.persistence.journal.leveldb.LeveldbJournal.preStart(LeveldbJournal.scala:23)
at akka.actor.Actor$class.aroundPreStart(Actor.scala:510)
at akka.persistence.journal.leveldb.LeveldbJournal.aroundPreStart(LeveldbJournal.scala:23)
at akka.actor.ActorCell.create(ActorCell.scala:590)
at akka.actor.ActorCell.invokeAll1(ActorCell.scala:461)atakka.actor.ActorCell.systemInvoke(ActorCell.scala:483)atakka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:282)atakka.dispatch.Mailbox.run(Mailbox.scala:223)atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)atjava.util.concurrent.ThreadPoolExecutor1(ActorCell.scala:461) at akka.actor.ActorCell.systemInvoke(ActorCell.scala:483) at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:282) at akka.dispatch.Mailbox.run(Mailbox.scala:223) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
opendaylight 在windows server2012R2下启动运行报错修改opendaylight目录下 etc/system.properties,在文件中加入一句org.osgi.framework.os.name = Win32,保存后再次启动
opendaylight 在windows server2012R2下启动运行报错

错误2:Could not load library. Reasons: [no leveldbjni64-1.8 in java.library.path, no leveldbjni-1.8 in java.library.path, F:\CI-CD\dc-karaf-0.1.0-SNAPSHOT\data\cache\org.eclipse.osgi\bundles\183\1.cp\META-INF\native\windows64\leveldbjni.dll: Can’t find dependent libraries, F:\CI-CD\dc-karaf-0.1.0-SNAPSHOT\data\tmp\leveldbjni-64-1-93968114411212963.8: Can’t find dependent libraries]

我在将错误1中的配置文件修改后,启动又报错,这次报错信息不一样了
opendaylight 启动karaf ,错误信息如下:

73% [====================================================> ]Uncaught error from thread [opendaylight-
cluster-data-akka.persistence.dispatchers.default-plugin-dispatcher-23]: Could not load library. Reasons: [no leveldbjni
64-1.8 in java.library.path, no leveldbjni-1.8 in java.library.path, F:\CI-CD\dc-karaf-0.1.0-SNAPSHOT\data\cache\org.ecl
ipse.osgi\bundles\183\1.cp\META-INF\native\windows64\leveldbjni.dll: Can’t find dependent libraries, F:\CI-CD\dc-karaf-
0.1.0-SNAPSHOT\data\tmp\leveldbjni-64-1-93968114411212963.8: Can’t find dependent libraries], shutting down JVM since ‘a
kka.jvm-exit-on-fatal-error’ is enabled for for ActorSystem[opendaylight-cluster-data]
java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [no leveldbjni64-1.8 in java.library.path, no leveldbjn
i-1.8 in java.library.path, F:\CI-CD\dc-karaf-0.1.0-SNAPSHOT\data\cache\org.eclipse.osgi\bundles\183\1.cp\META-INF\nati
ve\windows64\leveldbjni.dll: Can’t find dependent libraries, F:\CI-CD\dc-karaf-0.1.0-SNAPSHOT\data\tmp\leveldbjni-64-1-9
3968114411212963.8: Can’t find dependent libraries]
at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:187)
at org.fusesource.hawtjni.runtime.Library.load(Library.java:143)
at org.fusesource.leveldbjni.JniDBFactory.(JniDBFactory.java:48)
at akka.persistence.journal.leveldb.LeveldbStoreclass.leveldbFactory(LeveldbStore.scala:52)atakka.persistence.journal.leveldb.LeveldbJournal.leveldbFactory(LeveldbJournal.scala:23)atakka.persistence.journal.leveldb.LeveldbStoreclass.leveldbFactory(LeveldbStore.scala:52) at akka.persistence.journal.leveldb.LeveldbJournal.leveldbFactory(LeveldbJournal.scala:23) at akka.persistence.journal.leveldb.LeveldbStoreclass.preStart(LeveldbStore.scala:178)
at akka.persistence.journal.leveldb.LeveldbJournal.preStart(LeveldbJournal.scala:23)
at akka.actor.Actor$class.aroundPreStart(Actor.scala:510)
at akka.persistence.journal.leveldb.LeveldbJournal.aroundPreStart(LeveldbJournal.scala:23)
at akka.actor.ActorCell.create(ActorCell.scala:590)
at akka.actor.ActorCell.invokeAll1(ActorCell.scala:461)atakka.actor.ActorCell.systemInvoke(ActorCell.scala:483)atakka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:282)atakka.dispatch.Mailbox.run(Mailbox.scala:223)atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)atjava.util.concurrent.ThreadPoolExecutor1(ActorCell.scala:461) at akka.actor.ActorCell.systemInvoke(ActorCell.scala:483) at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:282) at akka.dispatch.Mailbox.run(Mailbox.scala:223) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
opendaylight 在windows server2012R2下启动运行报错出现这个错误是找不到依赖,是因为在运行时用到了dll外部文件,而系统中没有可以解析运行这文件的环境。想要了解详细信息的可以看system\org\fusesource\leveldbjni\leveldbjni-all目录下的jar包详细信息,入口是JniDBFactory 类的open()方法,在static中 NativeDB.LIBRARY.load();进行了加载dll
opendaylight 在windows server2012R2下启动运行报错
解决办法,在windows server2012中安装Mircrosoft Visual C++软件,这个版本不同也会运行不起,我试了很多个版本,最后如下2010版本下,karaf运行成功。我的opendaylight版本是Carbon-SR4。因为这个版本不好找,这里提供百度网盘下载地址
链接:https://pan.baidu.com/s/15A-9yjB7uzb0kuhsCwqY_g
提取码:s52c
opendaylight 在windows server2012R2下启动运行报错
安装成功后,再次启动karaf,成功
opendaylight 在windows server2012R2下启动运行报错两个错误是独立的,之前另一台机器启动只报了错误2,按照方法解决后成功启动,对应错误修改对应配置就可以了,不用两个都修改