本文介绍了安装org.fusesource.leveldbjni时引发Karaf异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在karaf中安装以下依赖项

Hi i am trying to install the below dependency in karaf

<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功能,并且其中一个功能在内部使用此依赖项.我错过了什么吗,请帮忙.

I am trying to install some opendaylight features and one of the features internally uses this dependency. Am i missing out something please help.

推荐答案

捆绑软件"leveldbjni"具有对本机"库的依赖.原生,如依赖于操作系统".在OSGi中,捆绑软件可以声明多个本机库,并为每个库指定何时可以加载该库.

The bundle "leveldbjni" has a dependency on a "native" library. Native as in "os dependent". In OSGi, a bundle can declare several natives libraries, and specify, for each library, when this library can be loaded.

出现错误时,您可以看到此捆绑包可以加载哪个库:

In your error, you can see which library this bundle can load:

  • windows32/leveldbjni.dll,如果处理器= x86; osname = Win32
  • windows64/leveldbjni.dll,如果处理器= x86-64; osname = Win32
  • osx/libleveldbjni.jnilib,如果处理器= x86; osname = macosx
  • osx/libleveldbjni.jnilib,如果处理器= x86-64; osname = macosx
  • linux32/libleveldbjni.so,如果处理器= x86; osname = Linux
  • linux64/libleveldbjni.so,如果处理器= x86-64; osname = Linux
  • windows32/leveldbjni.dll if processor=x86; 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",因此没有与此名称匹配的库,并且要求失败.

In your case, osname="Windows 8.1", so there is no library matching this name, and the requirement fails.

每个OSGi框架都有一个用于映射osname-s的别名"列表.这取决于您的实现(和版本).例如,最新版的Equinox 具有以下配置:

Each OSGi framework has a list of "alias" for mapping osname-s. It depends on your implementation (and versions). For example, the latest version of Equinox has this configuration:

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

Felix 中:

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

我不知道使用哪个框架或哪个版本,但是如果使用Felix(这是默认框架),则可以尝试在文件etc/system.properties中添加:

I don't know which framework you use, or which version, but if you use Felix (which is the default), you can try to add, in the file etc/system.properties :

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

在Equinox中,此问题已在臭虫423970 上进行了跟踪.我不知道如何覆盖这些属性. Karaf 4具有应该可用的Equinox版本.

In Equinox, this issue is tracked on Bug 423970. I don't know how to override these properties. Karaf 4 has a version of Equinox which should work.

您可以尝试在etc/system.properties中覆盖os的值(老实说,我不知道它是否会工作,因为应该发现此值-硬编码该值是一个丑陋的技巧)

You can try, maybe, to override in etc/system.properties the value of the os (Honestly, I don't know if it will work as this value should be discovered - and it's an ugly hack to hardcode this value)

org.osgi.framework.os.name = Win32

这篇关于安装org.fusesource.leveldbjni时引发Karaf异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 13:22