I'm loading a native library using System.loadLibrary("<lib name>"). When i run the java program via cmd line it works fine and it is able to load the library and its dependent libraries. However, when I do this in a web app it gives the following error:
PWC1406: Servlet.service() for servlet LoadLib threw exception
java.lang.UnsatisfiedLinkError: <main lib name>: ld.so.1: java: fatal: <dependent lib name>: open failed: No such file or directory
The library i'm loading is dependent on few other libraries. All these libraries (dependent and the main library) are placed in folders that are present in the LD_LIBRARY_PATH. The problem is that the web app is able to find the main library and while trying to load its dependent libraries it is giving error. I'm not sure whats going on here since it works from a standalone java program. All the permissions are properly set.
Why isn't it able to find/open the dependent library?
I'm using Glassfish server on Sun Solaris 4u / Sun-Fire-V440. Java version: 1.6.0_10.
Any pointers to what's going on with this problem will be much appreciated.