Write an MBean that does the
You are correct, you shouldn't be doing this
Actually JARDeployer resp. its super class SubDeployerSupport does that already.
SubDeployerSupport calls System.load(..) for every dynamic library found in a jar file that is deployed. However, since the call to System.load is in SubDeployerSupport (which is not loaded by UCL) the native library is associated with the wrong classloader and thus unusable for the code in the deployed jar file.
What is the use case of this deployment of native libraries in SubDeployerSupport? Has it worked before?
I loaded the native dll library using the MBEAN approach, but I am still getting unsatisfied link errors.
I called System.loadLibrary() in a static initializer in my MBEAN:
//loads the project_api.dll
System.out.println("....................STARTING LOADING THE DLL");
System.out.println("....................FINISHED LOADING THE DLL");
String lErrorMsg = "Native project_api code library failed to load.\n";
System.out.println(lErrorMsg + unsatisfiedlinkerror.getMessage());
Can anyone refer me to an example of using an MBEAN to load a Native Library or provide me with any ideas? By the way, I implemented a Standard MBEAN.
I then called my MBEAN from my Stateful Session EJB and once again I received an UnsatisfiedLink Exception.