John Carraher
John Carraher

Reputation: 63

JavaFX on Docker - Error initializing QuantumRenderer: no suitable pipeline found

I am trying to run a todolist jar in a docker container with the Dockerfile shown below. The file builds fine, but when I try to run it (through XcXsrv) with the command docker run -it --rm -e DISPLAY=host.docker.internal:0.0 todolist I get the error below. I get the same error with the RUN line included and not included. I've looked online for solutions and all solutions I tried have been added to the RUN line.

Error

C:\Users\jkcar\IdeaProjects\toDoList>docker run -it --rm -e DISPLAY=host.docker.internal:0.0 todolist
Graphics Device initialization failed for :  es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:244)
        at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:260)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
        at java.base/java.lang.Thread.run(Thread.java:832)
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: No toolkit found
        at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:272)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
        ... 5 more

Dockerfile

#Run image of OpenJDK on Desbian Buster
FROM openjdk:14-buster

#The line below contains all the solutions I've tried online. Unfortunately the program works with this line included or not included
RUN apt-get update && apt-get install -y xvfb && apt-get install -y openjfx openjfx-source libopenjfx-java libopenjfx-jni && apt-get install -y -f libgtk-3-dev

COPY library/javafx-sdk-14.0.2.1 javafx-sdk-14.0.2.1
COPY out/artifacts/toDoList_jar/toDoList.jar toDoList.jar

ENTRYPOINT java --module-path /javafx-sdk-14.0.2.1/lib --add-modules javafx.controls,javafx.fxml -jar toDoList.jar -Dprism.verbose=true

Does anyone have any pointers as to what I might be missing?

Upvotes: 3

Views: 1581

Answers (1)

John Carraher
John Carraher

Reputation: 63

Turns out my javaFX SDK was for Windows JavaFX. Once I changed the javafx-sdk to the linux version it worked perfectly.

Upvotes: 2

Related Questions