tags:

views:

287

answers:

1

I'm trying to run Java Advanced Imaging (JAI) within an OSGi container (spring-dm). I'm able to access the JAI libraries, but receive the following error when I call JAI for the first time:

Error: Could not load mediaLib accelerator wrapper classes. Continuing in pure Java mode.
Occurs in: com.sun.media.jai.mlib.MediaLibAccessor
com.sun.media.jai.mlib.MediaLibLoadException

The DLLs are on the classpath and referenced as Bundle-NativeCode libraries in my Manifest. Is it possible to run the native JAI DLLs within OSGi? If so, what do I need to do?

(edit: clarifications)

I downloaded the Windows JAI library and extracted JARs and DLLs from the download package.

Mainfest:

Manifest-Version: 1.0
Bundle-Name: Java Advanced Imaging
Bundle-SymbolicName: javax.media.jai
Bundle-Version: 1.1.3
Bundle-ClassPath: libs/,
 jai_codec.jar,
 jai_core.jar,
 mlibwrapper_jai.jar
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-NativeCode: libs/mlib_jai_mmx.dll; osname=WindowsXP; processor=x86, 
 libs/mlib_jai_util.dll; osname=WindowsXP; processor=x86, 
 libs/mlib_jai.dll; osname=WindowsXP; processor=x86
Export-Package:
+1  A: 

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.

hbunny
Thanks, that works...seems like a silly issue to have run into. In general the Manifests I'm making are managed by the Eclipse PDT -- unfortunately there's no support for native code (at least through the GUI), and I hadn't found any bundling of the JAI code.
Mark E