2016-02-28 93 views
1

嗨,我正嘗試安裝在karaf下面的依賴Karaf異常被拋出,而安裝org.fusesource.leveldbjni

<dependency> 
    <groupId>org.fusesource.leveldbjni</groupId> 
    <artifactId>leveldbjni-all</artifactId> 
    <version>1.8</version> 
</dependency> 

我得到下面的異常

Exception caught while executing command 
org.apache.karaf.shell.console.MultiException: Error executing command on bundles: 
    Unable to execute command on bundle 564: The bundle "org.fusesource.leveldbjni.leveldbjni-all_1.8.0 [564]" could not be resolved. Reason: No match found for native code: META-INF/native/windows32/leveldbjni.dll; processor=x86; osname=Win32, META-INF/native/windows64/leveldbjni.dll; processor=x86-64; osname=Win32, META-INF/native/osx/libleveldbjni.jnilib; processor=x86; osname=macosx, META-INF/native/osx/libleveldbjni.jnilib; processor=x86-64; osname=macosx, META-INF/native/linux32/libleveldbjni.so; processor=x86; osname=Linux, META-INF/native/linux64/libleveldbjni.so; processor=x86-64; osname=Linux 
    at org.apache.karaf.shell.console.MultiException.throwIf(MultiException.java:92) 
    at org.apache.karaf.bundle.command.BundlesCommandWithConfirmation.doExecute(BundlesCommandWithConfirmation.java:58) 
    at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:50) 
    at org.apache.karaf.bundle.command.BundlesCommandWithConfirmation.doExecute(BundlesCommandWithConfirmation.java:41) 
    at org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:33) 
    at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:39) 
    at org.apache.karaf.shell.commands.basic.AbstractCommand.execute(AbstractCommand.java:33) 
    at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_79] 
    at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_79] 
    at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:54) 
    at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:119) 
    at org.apache.karaf.shell.console.commands.$BlueprintCommand1099159826.execute(Unknown Source)[37:org.apache.karaf.shell.console:3.0.1] 
    at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_79] 
    at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_79] 
    at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:54) 
    at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:119) 
    at org.apache.karaf.shell.console.commands.$BlueprintCommand1099159826.execute(Unknown Source)[37:org.apache.karaf.shell.console:3.0.1] 
    at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[37:org.apache.karaf.shell.console:3.0.1] 
    at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:477)[37:org.apache.karaf.shell.console:3.0.1] 
    at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:403)[37:org.apache.karaf.shell.console:3.0.1] 
    at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[37:org.apache.karaf.shell.console:3.0.1] 
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[37:org.apache.karaf.shell.console:3.0.1] 
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[37:org.apache.karaf.shell.console:3.0.1] 
    at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89) 
    at org.apache.karaf.shell.console.impl.jline.ConsoleImpl$DelegateSession.execute(ConsoleImpl.java:521) 
    at org.apache.karaf.shell.console.impl.jline.ConsoleImpl.run(ConsoleImpl.java:212) 
    at java.lang.Thread.run(Thread.java:745)[:1.7.0_79] 
    at org.apache.karaf.shell.console.impl.jline.ConsoleFactoryService$3.doRun(ConsoleFactoryService.java:126)[37:org.apache.karaf.shell.console:3.0.1] 
    at org.apache.karaf.shell.console.impl.jline.ConsoleFactoryService$3$1.run(ConsoleFactoryService.java:117) 
    at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_79] 
    at org.apache.karaf.jaas.modules.JaasHelper.doAs(JaasHelper.java:47)[38:org.apache.karaf.jaas.modules:3.0.1] 
    at org.apache.karaf.shell.console.impl.jline.ConsoleFactoryService$3.run(ConsoleFactoryService.java:115)[37:org.apache.karaf.shell.console:3.0.1] 
Caused by: java.lang.Exception: Unable to execute command on bundle 564: The bundle "org.fusesource.leveldbjni.leveldbjni-all_1.8.0 [564]" could not be resolved. Reason: No match found for native code: META-INF/native/windows32/leveldbjni.dll; processor=x86; osname=Win32, META-INF/native/windows64/leveldbjni.dll; processor=x86-64; osname=Win32, META-INF/native/osx/libleveldbjni.jnilib; processor=x86; osname=macosx, META-INF/native/osx/libleveldbjni.jnilib; processor=x86-64; osname=macosx, META-INF/native/linux32/libleveldbjni.so; processor=x86; osname=Linux, META-INF/native/linux64/libleveldbjni.so; processor=x86-64; osname=Linux 
    at org.apache.karaf.bundle.command.BundlesCommandWithConfirmation.doExecute(BundlesCommandWithConfirmation.java:55) 
    ... 32 more 
Caused by: org.osgi.framework.BundleException: The bundle "org.fusesource.leveldbjni.leveldbjni-all_1.8.0 [564]" could not be resolved. Reason: No match found for native code: META-INF/native/windows32/leveldbjni.dll; processor=x86; osname=Win32, META-INF/native/windows64/leveldbjni.dll; processor=x86-64; osname=Win32, META-INF/native/osx/libleveldbjni.jnilib; processor=x86; osname=macosx, META-INF/native/osx/libleveldbjni.jnilib; processor=x86-64; osname=macosx, META-INF/native/linux32/libleveldbjni.so; processor=x86; osname=Linux, META-INF/native/linux64/libleveldbjni.so; processor=x86-64; osname=Linux 
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1332) 
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1316) 
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323) 
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300) 
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:292) 
    at org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:27) 
    at org.apache.karaf.bundle.command.BundlesCommandWithConfirmation.doExecute(BundlesCommandWithConfirmation.java:53) 
    ... 32 more 

我試圖安裝一些opendaylight特性和其中一個特性在內部使用這種依賴關係。我錯過了什麼,請幫助。

+0

錯誤表示找不到處理器/ os的本機庫。屬性'org.osgi.framework.os.name'和'org.osgi.framework.os.processor'的值是什麼(你可以用命令'system:property'查看它們) –

+0

org.osgi.framework .os。name = window 8.1 org.osgi.framework.os.version = 6.3.0 我可以找到屬性的值org.osgi.framework.os.processor – Charity

+0

stacktrace是說它無法找到dll。該DLL是依賴關係jar本身的一部分。 http://www.java2s.com/Code/Jar/l/Downloadleveldbjniall17jar.htm。 FYI我採取了opendaylight karaf分佈。 https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/org/opendaylight/integration/distribution-karaf/0.4.0-SNAPSHOT。 – Charity

回答

3

捆綁「leveldbjni」依賴於「本機」庫。本地,如「依賴於操作系統」。在OSGi中,一個bundle可以聲明幾個本地庫,併爲每個庫指定何時可以加載這個庫。

在你的錯誤,你可以看到這個包可以加載的庫:

  • windows32/leveldbjni.dll如果處理器= 86; osname = Win32
  • windows64/leveldbjni.dll if processor = x86-64; osname = Win32
  • osx/libleveldbjni.jnilib if processor = x86; osname = macosx
  • osx/libleveldbjni.jnilib if processor = x86-64; osname = macosx
  • linux32/libleveldbjni.so if processor = x86; osname = Linux
  • linux64/libleveldbjni.so if processor = x86-64; osname = Linux

在你的情況下,osname =「Windows 8.1」,所以沒有匹配這個名字的庫,並且需求失敗。

每個OSGi框架都有一個映射osname-s的「別名」列表。這取決於你的實現(和版本)。例如,latest version of Equinox有此配置:

Windows8 "Windows 8" "Windows 8.1" "Windows 8.2" "Windows 8.3" Win8 Win32 # Microsoft 

Felix

felix.native.osname.alias.windows8=windows 8,win32 

我不知道你使用的框架,或者是哪個版本,但是如果你使用菲利克斯(這是默認),你可以嘗試添加,文件etc/system.properties在:

felix.native.osname.alias.windows8=windows 8,windows 8.1,win32 

在春分,這個問題上Bug 423970跟蹤。我不知道如何覆蓋這些屬性。卡拉夫4有一個應該工作的Equinox版本。

你可以試試,也許,在etc/system.properties重寫OS的值(老實說,我不知道這是否將作爲這個值應該被發現 - 這是一個醜陋的黑客硬編碼此值)

org.osgi.framework.os.name = Win32 
+0

在我的karaf 4.0.3中,我無法在system.properties中找到此條目。那麼我應該添加並看看? – Charity

+0

是的,你應該添加它,「並參見」:-) –

+0

我已經在system.properties中的條目。卡拉夫仍然拋出同樣的錯誤。 – Charity

0

作爲解決方法,在etc/system.properties中通過向其添加org.osgi.framework.os.name = Win32來對操作系統進行硬編碼。這是Jeremie B爲我解決問題的答案的最終建議。