Docker上的JavaFX-初始化QuantumRenderer时出错:找不到合适的管道 [英] JavaFX on Docker - Error initializing QuantumRenderer: no suitable pipeline found
问题描述
我正在尝试使用以下所示的Dockerfile在Docker容器中运行todolist jar.该文件构建良好,但是当我尝试使用命令 docker run -it --rm -e DISPLAY = host.docker.internal:0.0 todolist
(通过XcXsrv)运行它时,出现以下错误.在包含和不包含RUN行的情况下,我得到相同的错误.我在网上寻找解决方案,而我尝试过的所有解决方案均已添加到RUN行中.
错误
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
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?
推荐答案
结果证明我的javaFX SDK适用于Windows JavaFX.一旦我将javafx-sdk更改为linux版本,它就可以正常工作.
Turns out my javaFX SDK was for Windows JavaFX. Once I changed the javafx-sdk to the linux version it worked perfectly.
这篇关于Docker上的JavaFX-初始化QuantumRenderer时出错:找不到合适的管道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!