Nick,

JMagick comes as a semi-stub library .jar archive and a native library
libJMagick.so - under the command line my code works (following "ldconfig"),
but I get errors in the catalina.out complaining about being unable to find
the library (details at the end of this message). the key clause being:

"Caused by: java.lang.RuntimeException: Can't load MagickLoader (class not
found)
        at magick.Magick.<clinit>(Magick.java:25)"

Essentially, having trawled through the various documentation, I haven't
worked out how to direct Tomcat to find/use the .so library, so any pointers
to how to do this would be great.

I'm not sure where it is, but I'm sure that Tomcat has a directory that's specified as a search path for shared libs. Your JMagick class's <clinit> (public static { }) method is bombing probably because a call to System.loadLibrary() can't find the shared lib.

Can anyone say if Tomcat itself provides 'another' directory where shared objects can go?

You can put it in the SDK somewhere, but that's ugly.

Finally, let me issue a word of warning: using native code from a webapp is pretty dangerous: if the native code, say, segfaults, then Tomcat will go down along with all your webapps. Also, you have to be careful: the JVM gets very upset if you call System.loadLibrary() more than once for a given library. So, you should take care to have your JMagick library sitting in a common area, rather than your webapp's WEB-INF/lib directory. (Unless you promose never to re-start your webapp without re-starting Tomcat ;)

-chris

Attachment: signature.asc
Description: OpenPGP digital signature



Reply via email to