Problem running JavaFX in maven plugins

Dan Armbrust daniel.armbrust.list at gmail.com
Tue Jan 1 03:54:14 UTC 2019


Hi,

I'm trying to migrate a codebase to JDK 11 / OpenJFX, and have run into an issue I didn't 
have under JDK 8.

We have a complex maven build process - parts of which include building our own maven 
plugins, and then executing those plugins in a different portion of the build.

Maven uses isolated Plugin Classloaders for each plugin execution: 
https://maven.apache.org/guides/mini/guide-maven-classloading.html

When my plugin executes, its going down a path that needs to start up the JavaFX subsystem 
- mostly to get support for tasks and such (we are actually building headless, with a hack 
of a HeadlessToolkit shimmed in to make JavaFX actually work headless) but - it would 
appear that because some other class loader in my build process already hit the JavaFX 
startup once... I fail on a native library load:

Loading library glass from resource failed: java.lang.UnsatisfiedLinkError: Native Library 
/home/darmbrust/.openjfx/cache/11/libglass.so already loaded in another classloader
java.lang.UnsatisfiedLinkError: Native Library 
/home/darmbrust/.openjfx/cache/11/libglass.so already loaded in another classloader
         at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2456)
         at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2684)
         at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2617)
         at java.base/java.lang.Runtime.load0(Runtime.java:767)
         at java.base/java.lang.System.load(System.java:1831)
         at 
com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:205)
         at 
com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:185)
         at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:157)
         at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:52)
         at com.sun.glass.ui.Application.loadNativeLibrary(Application.java:110)
         at com.sun.glass.ui.Application.loadNativeLibrary(Application.java:118)
         at com.sun.glass.ui.gtk.GtkApplication.lambda$static$2(GtkApplication.java:109)
         at java.base/java.security.AccessController.doPrivileged(Native Method)
         at com.sun.glass.ui.gtk.GtkApplication.<clinit>(GtkApplication.java:108)
         at 
com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(GtkPlatformFactory.java:41)
         at com.sun.glass.ui.Application.run(Application.java:144)
         at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:258)
         at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:269)

Any suggestions on how to deal with this?

I'm running on linux with:
openjdk 11.0.1 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)

I'm going to try this hack and see if it works: 
https://stackoverflow.com/questions/28369180/multiple-maven-plugin-dependencies-native-library-already-loaded-in-another-cl

But it would be nice to have a proper solution for this.

Also, on a completely unrelated note, where the heck is the JavaFX bug tracker these 
days?  There seems to be no end to confusing information out there about where the bug 
tracker is, multiple github mirrors have trackers, and the place that should clarify this 
says nothing: https://openjfx.io/

Multiple Oracle pages still point to the Jira, many other pages point to the 
bugreport.java.com, others point to https://bugs.openjdk.java.net/ but that shows no 
javafx project.

Is this one official now? https://github.com/javafxports/openjdk-jfx/issues


Thanks,
Dan



More information about the openjfx-dev mailing list