1

我正在尝试在 OSGi 容器 (spring-dm) 中运行 Java Advanced Imaging (JAI)。我能够访问 JAI 库,但是当我第一次调用 JAI 时收到以下错误:

错误:无法加载 mediaLib 加速器包装类。继续纯 Java 模式。
出现在:com.sun.media.jai.mlib.MediaLibAccessor
com.sun.media.jai.mlib.MediaLibLoadException

DLL 位于类路径中,并在我的清单中作为 Bundle-NativeCode 库引用。是否可以在 OSGi 中运行本机 JAI DLL?如果是这样,我需要做什么?

(编辑:澄清)

我下载了 Windows JAI 库并从下载包中提取了 JAR 和 DLL。

主祭:

清单版本:1.0
捆绑包名称:Java 高级成像
捆绑符号名称:javax.media.jai
捆绑版本:1.1.3
捆绑类路径:libs/,
 jai_codec.jar,
 jai_core.jar,
 mlibwrapper_jai.jar
Bundle-RequiredExecutionEnvironment:JavaSE-1.6
Bundle-NativeCode:libs/mlib_jai_mmx.dll;操作系统名=WindowsXP;处理器=x86,
 库/mlib_jai_util.dll;操作系统名=WindowsXP;处理器=x86,
 库/mlib_jai.dll;操作系统名=WindowsXP;处理器=x86
出口包装:
4

1 回答 1

2

The declaration of the Bundle-NativeCode block doesn't look right. According to the OSGi specification (which I highly recommend you download - it's pretty straight-forward), all libraries for a single platform should be specified in the same clause, so that changes it to:

Bundle-NativeCode: libs/mlib_jai_mmx.dll; libs/mlib_jai_util.dll; libs/mlib_jai.dll; 
 osname=WindowsXP; 
 processor=x86

In general I don't recommend rolling your own bundle manifests if you can find them elsewhere (this one is pretty simple besides the native code part). In this case, I found them 2 of them at the Spring repository. It doesn't include the native code part - probably due to license issues.

于 2009-09-29T17:45:18.637 回答