Собственный образ с использованием плагина GraalVM, Maven, GluonFX — проблема с пакетом ресурсов com.sun.glass.ui.win
Версия GraalVM: 21.2.0 Версия JavaFX: 17.0.0.1 Версия Maven: 3.6.3
Я очень близок к тому, чтобы запустить свой собственный образ, я добавил классы в свой список отражений в pom.xml и т. Д., Но теперь я останавливаюсь из-за ошибки ResourceBundle Not Found. Если бы кто-нибудь мог дать мне подсказку, это было бы очень признательно.
Вот мой pom.xml:
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>MyProject-fxml.main</groupId>
<artifactId>MyProject-fxml</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>17.0.0.1</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>17.0.0.1</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>17.0.0.1</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>17.0.0.1</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>22.0.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>1.0.6</version>
<configuration>
<mainClass>com.MyProject.Main</mainClass>
<reflectionList>
<list>com.MyProject.MyProject</list>
<list>com.MyProject.controllers.MainViewController</list>
<list>com.MyProject.controllers.stagecontrollers.SimpleStageController</list>
<list>com.MyProject.model.helpers.AppPreferences</list>
<list>com.MyProject.model.helpers.ScreenResolution</list>
<list>javafx.scene.control.SplitPane</list>
<list>javafx.scene.layout.AnchorPane</list>
</reflectionList>
<resourcesList>com.sun.glass.ui.win</resourcesList>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.7</version>
<configuration>
<mainClass>com.MyProject.Main</mainClass>
</configuration>
</plugin>
<!-- TODO: Figure out how to make an executable jar with Maven -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix></classpathPrefix>
<mainClass>com.MyProject.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>run-java</id>
<phase>package</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.MyProject.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
Далее следует вывод ошибки:
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] Oct 09, 2021 11:19:12 AM com.sun.javafx.application.PlatformImpl startup
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @2715644a'
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] Exception in Application start method
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] Oct 09, 2021 11:19:12 AM com.MyProject.APP show
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] SEVERE: There is an error launching the JavaFX runtime, or the application class cannot be constructed (e.g., if the class is not public or is not in an exported package), or an Exception or Error is thrown by the Application constructor, init method, start method, or stop method.java.lang.RuntimeException: Exception in Application start method
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] java.lang.RuntimeException: Exception in Application start method
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:901)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.lang.Thread.run(Thread.java:829)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:567)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] Caused by: java.lang.ExceptionInInitializerError
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:315)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.lang.Class.ensureInitialized(DynamicHub.java:548)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:260)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.lang.reflect.Constructor.newInstance(Constructor.java:490)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(FXMLLoader.java:1020)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:757)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2808)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2634)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2516)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.MyProject.MyProject.loadMainViewParent(APP.java:88)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.MyProject.MyProject.start(APP.java:55)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:847)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:484)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.security.AccessController.doPrivileged(AccessController.java:105)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(JNIJavaCallWrappers.java:0)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.glass.ui.win.WinApplication._runLoop(WinApplication.java)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] ... 3 more
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] Caused by: java.util.MissingResourceException: Can't find bundle for base name com/sun/glass/ui/win/themes, locale en_US
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:2055)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1689)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1593)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1556)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.util.ResourceBundle.getBundle(ResourceBundle.java:857)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.glass.ui.win.WinApplication.getHighContrastScheme(WinApplication.java:344)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.glass.ui.win.WinApplication.getHighContrastTheme(WinApplication.java:350)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.tk.quantum.QuantumToolkit.getThemeName(QuantumToolkit.java:1809)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl._setPlatformUserAgentStylesheet(PlatformImpl.java:924)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.setPlatformUserAgentStylesheet(PlatformImpl.java:723)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.setDefaultPlatformUserAgentStylesheet(PlatformImpl.java:687)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at javafx.scene.control.Control.<clinit>(Control.java:99)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] ... 23 more
[Sat Oct 09 11:19:12 CEST 2021][SEVERE] Process run until end failed with result: 1
Итак, ресурс "com/sun/glass/ui/win/themes" отсутствует. Однако я не могу найти, как исправить это.
1 ответ
Благодаря Хосе Переда, добавление вышеуказанного пакета в
<bundleslist/>
к
gluonfx-maven-plugin
работало, хотя IntelliJ не показывал, что этот путь имеет пакет с таким именем.