https://bz.apache.org/bugzilla/show_bug.cgi?id=62830
Bug ID: 62830 Summary: Add static methods to load native libraries by the Common ClassLoader Product: Tomcat 9 Version: unspecified Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P2 Component: Catalina Assignee: dev@tomcat.apache.org Reporter: isa...@apache.org Target Milestone: ----- By design, a native library may not be loaded by more than one ClassLoader. >From [1]: > In the JDK, each class loader manages its own set of native libraries. > The same JNI native library cannot be loaded into more than one class loader. > Doing so causes UnsatisfiedLinkError to be thrown. For example, > System.loadLibrary throws an UnsatisfiedLinkError when used to load a native > library into two class loaders. Due to that restriction, Native Libraries that are loaded by Webapp ClassLoaders may only be loaded in one Webapp. Subsequent Webapps that attempt to load the same native library fail with an UnsatisfiedLinkError. A working solution [2] proposes to create a small jar with a method that will load the native libraries, and place it in ${CATALINA_BASE}/lib so that it will be loaded by the Common ClassLoader. A simpler solution would be to add the static methods `load(filename)` and `loadLibrary(libname)` that will simply call the respective System methods. That will eliminate the need to create custom jar files and place them in the lib directory. Patch coming shortly. [1] https://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/invocation.html#library_version [2] https://stackoverflow.com/questions/36936948/java-lang-unsatisfiedlinkerror-native-library-xxx-so-already-loaded-in-another -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org