Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NativeResourceUnloadWebListener fails when JNA is not on the class path. #686

Closed
mrotteveel opened this issue Jan 31, 2022 · 1 comment
Closed

Comments

@mrotteveel
Copy link
Member

mrotteveel commented Jan 31, 2022

The NativeResourceUnloadWebListener fails when JNA is not on the classpath as reported on https://groups.google.com/g/firebird-java/c/aRrtXQGR5Dg, as it will fail to find com.sun.jna.Library when loading FbClientLibrary. The lookup of the class loader should be isolated, or any errors when loading it should be swallowed.

Exception sending context initialized event to listener instance of class [org.firebirdsql.gds.ng.jna.NativeResourceUnloadWebListener]
java.lang.NoClassDefFoundError: com/sun/jna/Library
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2478)
        at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:870)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1371)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1215)
        at org.firebirdsql.gds.ng.jna.NativeResourceUnloadWebListener.jaybirdLoadedInContext(NativeResourceUnloadWebListener.java:54)
        at org.firebirdsql.gds.ng.jna.NativeResourceUnloadWebListener.contextInitialized(NativeResourceUnloadWebListener.java:40)

Workarounds:

  • Set system property org.firebirdsql.nativeResourceShutdownDisable to true
  • Add jna-5.5.0 (or higher) to the class path
@mrotteveel
Copy link
Member Author

Fixed by checking class loader of FbClientDatabaseFactory instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment