from Jaybird 3.0.12 to Jaybird 4.0.5

49 views
Skip to first unread message

Davide Zavagnin

unread,
Jan 31, 2022, 12:55:42 PM1/31/22
to firebird-java
Hi,
in Jaybird 4.0.5 Release Notes I found this:
  1. If installed, remove jna-4.4.0.jar and replace it with jna-5.5.0.jar. This library is only necessary for native, local or embedded connections. If you use pure-java connections (the default), you don't need JNA.

Good I use pure-java don't need JNA and jna-5.5.0.jar
but this happens if I don't include jar, I put under the log 

I Noted from the source NativeResourceUnloadWebListener.java:54 and 40
this contrasts with other fixes always present in Jaybird 4.0.5 Release Notes.
it seems JNA is needed for this 

So I must set org.firebirdsql.nativeResourceShutdownDisabled to true to works without jna-5.5.0.jar?



7.25 Other fixes and changes
  • Native libraries will now be disposed on application exit (JDBC-519)

    On JVM exit or - if deployed inside a WAR - servlet context destroy (tested on Tomcat), Jaybird will call fb_shutdown on any loaded native libraries and dispose the JNA handle to the native library. This should prevent crashes (e.g. access violation / 0xc0000005 error on Windows) on library unload if there were still embedded connections open.

    Given the potential for bugs or timing issues with this feature, it can be disabled with system property org.firebirdsql.nativeResourceShutdownDisabled set to true. This property must be set before Jaybird is loaded, preferably on the Java command line.


: 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)

Mark Rotteveel

unread,
Jan 31, 2022, 1:26:56 PM1/31/22
to firebi...@googlegroups.com
On 2022-01-31 13:48, Davide Zavagnin wrote:
[..]
> Good I use pure-java don't need JNA and jna-5.5.0.jar
> but this happens if I don't include jar, I put under the log
>
> I Noted from the source NativeResourceUnloadWebListener.java:54 and 40
> this contrasts with other fixes always present in Jaybird 4.0.5
> Release Notes.
>
> it seems JNA is needed for this
>
> So I must set org.firebirdsql.nativeResourceShutdownDisabled to true
> to works without jna-5.5.0.jar?

This is a bug. It is a failure case I missed when implementing that
listener. Looking at how easy it is triggered, I'm surprised it hasn't
been reported before.

In any case, I have created
https://github.com/FirebirdSQL/jaybird/issues/686 to fix it in 4.0.6. In
the mean time, the workaround is to include jna-5.5.0.jar on the
classpath, or set the system property
org.firebirdsql.nativeResourceShutdownDisable to true.

Thank you for reporting this.

[..]

Davide Zavagnin

unread,
Feb 1, 2022, 10:59:24 AM2/1/22
to firebird-java
I can confirm both workarounds work
Reply all
Reply to author
Forward
0 new messages