First off, here is what is working, and then I'll describe what is not: Using SWIG, we have taken some third party code, and created the Java and C wrapper source. A jar file of the Java classes, and a shared library of the C wrapper code was created. We have a Java codebase that loads the shared library, and is able to invoke the native code as needed. This is running on Sun HostSpot JVM 1.5.0.14. No worries here.
Now, this is not working: Using the same JVM, jar file with of the Java wrapper code, and same shared library described above, I am trying to use Jython to do some scripting. The CLASSPATH and LD_LIBRARY_PATH environment vars are set correctly. From Jython, I am able to run java.lang.System.loadLibrary(...), and load the shared library without error. However, when the first native method from this library that is invoked for a Java object in my Jython script, I get an UnsatisfiedLinkError from the JVM.
I ran nm on the shared library, and I see that the method in question is present in the library (with the name mangling for native methods as described in the JNI spec). So, the question is, what could be stopping the JVM from resolving the method name?
I've been through the JNI spec, and I see that a library can be unloaded by the GC. Could that be happening before I invoke the method? What else can cause this to fail?