I have a Java Web application running in Tomcat8. I stored the native libraries in /bin folder of Tomcat installation.
I load libraries with JNA using
Native.loadLibrary("myLib",MyLib.class);
This works without any problem, if I have to update or reload the application it works.
My problem is a third-party library with its own native library. I stored it in the same /bin directory and it works, but when I reload the application Tomcat fails to load with this error:
java.lang.UnsatisfiedLinkError: Native Library ...already loaded in another classloader
If I restart tomcat service it works again. I found this problem only during the application reload.
Decompiling the third-party library I found that its native library is loaded with this command:
System.loadLibrary("thirdpartylib");
How can I force this library load at tomcat level without a UnsatisfiedLinkError in case of application reload?