I have come across what looks like a problem with classloading and JNI.
I am using oracle streams, JMS and XML. The oracle/JMS to JBoss interface I'm using is the Oracle AQ Patch 9i from the patches list (http://sourceforge.net/tracker/index.php?func=detail&aid=912173&group_id=22866&atid=376687)
by p0six (thanks!)
Now, the problem seems to be that two of the oracle jar files have classes with native methods (aqapi.jar and xdb.jar) but the implementations of these are in one shared library (libclntsh.so). If the two jar files are not loaded by the same classloader you seem to get problems with the java native to C symbol mapping. I think that the mapping is setup by the ClassLoader.loadLibrary call and is local to the classloader. So, if one jar in one classloader causes the load of the library any use of a class with native methods from the other jar fails with a LinkageError and the name of the native method.
My current workaround is to combine the oracle jars together into a single jar file but this is not a very pretty solution. Another workaround would be to ensure that all jars that load JNI implementations from a single shared library are loaded by the one class loader. Of course you have to know which jars will reference which libraries.
Have I understood how the classloaders and JNI libs are related and is there a way of handling this cleanly without an intimate understanding of which jars are using which shared libraries?
Any suggestions welcome.