Closed anidotnet closed 4 years ago
It may be possible, I spent a few hours trying to get it to work with ScalaFX, but couldn't get it to boot. Kotlin may be different/easier, esp. if you're already using Gradle.
What I tried for posterity:
+task fatJar(type: Jar) {
public int runProcess(String processName, File workingDirectory) throws IOException, InterruptedException {
sbt 'export runtime:fullClasspath'
java -jar -Dimagecp=$scalafx_class_path -Dgraalvm=$GRAALVM_HOME -Dmainclass=hello.ScalaFXHelloWorld -Dstep=LINK substrate.jar
"--initialize-at-build-time=scala.runtime.Statics$VM"
./build/autoclient/x86_64-darwin/anonymousApp
2020-06-16 00:29:52.110 anonymousApp[67531:6873549] Starting Gluon VM...
Exception in Application constructor
Exception in thread "main" java.lang.RuntimeException: Unable to construct Application instance: class scalafx.application.AppHelper
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:890)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.lang.Thread.run(Thread.java:834)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:517)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:193)
Caused by: java.lang.NoSuchMethodException: scalafx.application.AppHelper.<init>()
at java.lang.Class.getConstructor0(DynamicHub.java:3349)
at java.lang.Class.getConstructor(DynamicHub.java:2151)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:801)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.security.AccessController.doPrivileged(AccessController.java:101)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VARARGS:Ljava_lang_Runnable_2_0002erun_00028_00029V(JNIJavaCallWrappers.java:0)
I have a feeling this is because Substrate is adding 15-ea versions of JavaFx to the classpath, e.g. javafxStaticSdk/15-ea+gvm20/
and ScalaFX is compiled against 14.0.1, but I'm not sure.
EDIT: Still got the same exception when compiling Scala against 15-ea
Any update on this please?
I tried to run below tornadofx+kotlin code
package demo
import javafx.animation.KeyFrame
import javafx.animation.Timeline
import javafx.application.Platform
import javafx.beans.property.SimpleBooleanProperty
import javafx.beans.property.SimpleStringProperty
import javafx.event.EventHandler
import javafx.geometry.Pos
import javafx.scene.text.Font
import javafx.stage.Stage
import javafx.util.Duration
import tornadofx.*
class LoginApp : App(LoginScreen::class, Styles::class) {
val loginController: LoginController by inject()
override fun start(stage: Stage) {
super.start(stage)
loginController.init()
}
}
fun main(args: Array<String>) {
launch<LoginApp>(args)
}
class LoginController : Controller() {
val loginScreen: LoginScreen by inject()
val secureScreen: SecureScreen by inject()
fun init() {
with(config) {
if (containsKey(USERNAME) && containsKey(PASSWORD))
string(USERNAME)?.let { string(PASSWORD)?.let { it1 -> tryLogin(it, it1, true) } }
else
showLoginScreen("Please log in")
}
}
fun showLoginScreen(message: String, shake: Boolean = false) {
secureScreen.replaceWith(loginScreen, sizeToScene = true, centerOnScreen = true)
runLater {
if (shake) loginScreen.shakeStage()
}
}
fun showSecureScreen() {
loginScreen.replaceWith(secureScreen, sizeToScene = true, centerOnScreen = true)
}
fun tryLogin(username: String, password: String, remember: Boolean) {
runAsync {
username == "admin" && password == "secret"
} ui { successfulLogin ->
if (successfulLogin) {
loginScreen.clear()
if (remember) {
with(config) {
set(USERNAME to username)
set(PASSWORD to password)
save()
}
}
showSecureScreen()
} else {
showLoginScreen("Login failed. Please try again.", true)
}
}
}
fun logout() {
with(config) {
remove(USERNAME)
remove(PASSWORD)
save()
}
showLoginScreen("Log in as another user")
}
companion object {
val USERNAME = "username"
val PASSWORD = "password"
}
}
class LoginScreen : View("Please log in") {
val loginController: LoginController by inject()
private val model = object : ViewModel() {
val username = bind { SimpleStringProperty() }
val password = bind { SimpleStringProperty() }
val remember = bind { SimpleBooleanProperty() }
}
override val root = form {
addClass(Styles.loginScreen)
fieldset {
field("Username") {
textfield(model.username) {
required()
whenDocked { requestFocus() }
}
}
field("Password") {
passwordfield(model.password).required()
}
field("Remember me") {
checkbox(property = model.remember)
}
}
button("Login") {
isDefaultButton = true
action {
model.commit {
loginController.tryLogin(
model.username.value,
model.password.value,
model.remember.value
)
}
}
}
}
override fun onDock() {
model.validate(decorateErrors = false)
}
fun shakeStage() {
var x = 0
var y = 0
val cycleCount = 10
val move = 10
val keyframeDuration = Duration.seconds(0.04)
val stage = FX.primaryStage
val timelineX = Timeline(KeyFrame(keyframeDuration, EventHandler {
if (x == 0) {
stage.x = stage.x + move
x = 1
} else {
stage.x = stage.x - move
x = 0
}
}))
timelineX.cycleCount = cycleCount
timelineX.isAutoReverse = false
val timelineY = Timeline(KeyFrame(keyframeDuration, EventHandler {
if (y == 0) {
stage.y = stage.y + move
y = 1
} else {
stage.y = stage.y - move
y = 0
}
}))
timelineY.cycleCount = cycleCount
timelineY.isAutoReverse = false
timelineX.play()
timelineY.play()
}
fun clear() {
model.username.value = ""
model.password.value = ""
model.remember.value = false
}
}
class SecureScreen : View("Secure Screen") {
val loginController: LoginController by inject()
override val root = borderpane {
setPrefSize(800.0, 600.0)
top {
label(title) {
font = Font.font(22.0)
}
}
center {
vbox(spacing = 15) {
alignment = Pos.CENTER
label("If you can see this, you are successfully logged in!")
hbox {
alignment = Pos.CENTER
button("Logout") {
setOnAction {
loginController.logout()
}
}
button("Exit") {
setOnAction {
Platform.exit()
}
}
}
}
}
}
}
class Styles : Stylesheet() {
companion object {
val loginScreen by cssclass()
}
init {
loginScreen {
padding = box(15.px)
vgap = 7.px
hgap = 10.px
}
}
}
with maven pom.xml as below
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>mainModule</artifactId>
<groupId>me.anindya</groupId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mainModule</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.code.style>official</kotlin.code.style>
<kotlin.compiler.jvmTarget>11</kotlin.compiler.jvmTarget>
<mainClassName>demo.MyMainAppKt</mainClassName>
</properties>
<repositories>
<repository>
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
</repositories>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<mainClass>demo.MyMainAppKt</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>client-maven-plugin</artifactId>
<version>0.1.31</version>
<configuration>
<mainClass>${mainClassName}</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit</artifactId>
<version>1.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>no.tornado</groupId>
<artifactId>tornadofx</artifactId>
<version>1.7.20</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11.0.2</version>
</dependency>
</dependencies>
<pluginRepositories>
<pluginRepository>
<id>gluon-releases</id>
<url>http://nexus.gluonhq.com/nexus/content/repositories/releases/</url>
</pluginRepository>
</pluginRepositories>
</project>
After the build, when I try to run the native binary I am getting below error:
% ./mainModule Exception in Application constructor Exception in thread "main" java.lang.RuntimeException: Unable to construct Application instance: class demo.LoginApp at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:890) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195) at java.lang.Thread.run(Thread.java:834) at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:517) at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192) Caused by: java.lang.NoSuchMethodException: demo.LoginApp.<init>() at java.lang.Class.getConstructor0(DynamicHub.java:3349) at java.lang.Class.getConstructor(DynamicHub.java:2151) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:801) at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455) at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428) at java.security.AccessController.doPrivileged(AccessController.java:101) at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96) at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(JNIJavaCallWrappers.java:0) at com.sun.glass.ui.gtk.GtkApplication._runLoop(GtkApplication.java) at com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277) ... 3 more
I am building it on an ubuntu-20.04 machine
If you get java.lang.NoSuchMethodException
, you need to add the related class to the reflectionList
, in this case add demo.LoginApp
. Probably the other classes demo.LoginController
and demo.LoginView
too.
Where do I need to specify the reflectionList? Any documentation?
Thanks @jperedadnr .. I have changed the plugin section as follows:
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>client-maven-plugin</artifactId>
<version>0.1.31</version>
<configuration>
<mainClass>${mainClassName}</mainClass>
<reflectionList>
<list>demo.LoginApp</list>
<list>demo.LoginController</list>
<list>demo.LoginScreen</list>
<list>demo.SecureScreen</list>
<list>demo.Styles</list>
</reflectionList>
</configuration>
</plugin>
But I get below error during build
[Sun Aug 23 21:42:35 IST 2020][INFO] We will now compile your code for x86_64-linux-linux. This may take some time. [Sun Aug 23 21:42:40 IST 2020][INFO] [SUB] [demo.mymainappkt:17590] classlist: 4,307.00 ms, 0.96 GB [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] [demo.mymainappkt:17590] (cap): 797.81 ms, 0.94 GB [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] [demo.mymainappkt:17590] setup: 1,704.32 ms, 0.94 GB [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] Error: Error parsing reflection configuration in /home/anindya/codebase/tornadofx-demo/demo/target/client/x86_64-linux/gvm/reflectionconfig-x86_64-linux.json: [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] Could not register demo.LoginScreen: allPublicFields for reflection. Reason: java.lang.NoClassDefFoundError: Ljavafx/fxml/FXMLLoader;. To allow unresolvable reflection configuration, use option -H:+AllowIncompleteClasspath [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] Verify that the configuration matches the schema described in the -H:PrintFlags=+ output for option ReflectionConfigurationFiles. [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] com.oracle.svm.core.util.UserError$UserException: Error parsing reflection configuration in /home/anindya/codebase/tornadofx-demo/demo/target/client/x86_64-linux/gvm/reflectionconfig-x86_64-linux.json: [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] Could not register demo.LoginScreen: allPublicFields for reflection. Reason: java.lang.NoClassDefFoundError: Ljavafx/fxml/FXMLLoader;. To allow unresolvable reflection configuration, use option -H:+AllowIncompleteClasspath [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] Verify that the configuration matches the schema described in the -H:PrintFlags=+ output for option ReflectionConfigurationFiles. [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at com.oracle.svm.core.util.UserError.abort(UserError.java:68) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at com.oracle.svm.hosted.config.ConfigurationParserUtils.doParseAndRegister(ConfigurationParserUtils.java:138) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at com.oracle.svm.hosted.config.ConfigurationParserUtils.lambda$parseAndRegisterConfigurations$1(ConfigurationParserUtils.java:85) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.stream.ReferencePipeline$4$1.accept(ReferencePipeline.java:212) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.stream.IntPipeline.reduce(IntPipeline.java:491) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.stream.IntPipeline.sum(IntPipeline.java:449) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at com.oracle.svm.hosted.config.ConfigurationParserUtils.parseAndRegisterConfigurations(ConfigurationParserUtils.java:90) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at com.oracle.svm.reflect.hosted.ReflectionFeature.duringSetup(ReflectionFeature.java:69) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.lambda$setupNativeImage$12(NativeImageGenerator.java:876) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:70) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:876) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:553) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:468) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) [Sun Aug 23 21:42:42 IST 2020][INFO] [SUB] Error: Image build request failed with exit status 1 [Sun Aug 23 21:42:42 IST 2020][SEVERE] Process compile failed with result: 1 Check the log files under /home/anindya/codebase/tornadofx-demo/demo/target/client/x86_64-linux/gvm/log And please check https://docs.gluonhq.com/client/ for more information. [Sun Aug 23 21:42:42 IST 2020][INFO] Logging process [compile] to file: /home/anindya/codebase/tornadofx-demo/demo/target/client/log/process-compile-1598199162577.log [Sun Aug 23 21:42:42 IST 2020][SEVERE] Compiling failed. Check the log files under /home/anindya/codebase/tornadofx-demo/demo/target/client/x86_64-linux/gvm/log And please check https://docs.gluonhq.com/client/ for more information.
Add javafx-fxml to dependencies
I have added the dependency and this time another issue came up during build
[Sun Aug 23 22:39:54 IST 2020][INFO] We will now compile your code for x86_64-linux-linux. This may take some time. [Sun Aug 23 22:39:59 IST 2020][INFO] [SUB] [demo.mymainappkt:21427] classlist: 4,418.28 ms, 0.96 GB [Sun Aug 23 22:40:01 IST 2020][INFO] [SUB] [demo.mymainappkt:21427] (cap): 754.10 ms, 0.94 GB [Sun Aug 23 22:40:02 IST 2020][INFO] [SUB] [demo.mymainappkt:21427] setup: 2,415.80 ms, 0.94 GB [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] [demo.mymainappkt:21427] (clinit): 623.44 ms, 4.69 GB [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] [demo.mymainappkt:21427] (typeflow): 20,568.72 ms, 4.69 GB [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] [demo.mymainappkt:21427] (objects): 24,727.27 ms, 4.69 GB [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] [demo.mymainappkt:21427] (features): 2,546.30 ms, 4.69 GB [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] [demo.mymainappkt:21427] analysis: 49,840.70 ms, 4.69 GB [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Warning: Aborting stand-alone image build. Unsupported features in 3 methods [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Detailed message: [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: javafx.scene.web.WebView. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time. [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Trace: [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at parsing tornadofx.ControlsKt.webview(Controls.kt:25) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Call path from entry point to tornadofx.ControlsKt.webview(EventTarget, Function1): [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.ControlsKt.webview(Controls.kt) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.DefaultErrorHandler$showErrorDialog$$inlined$apply$lambda$1$1$2$2.invoke(ErrorHandler.kt:96) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.DefaultErrorHandler$showErrorDialog$$inlined$apply$lambda$1$1$2$2.invoke(ErrorHandler.kt:15) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.App$trayicon$1.run(App.kt:181) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(generated:0) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: javafx.scene.web.WebView. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time. [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Trace: [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at parsing tornadofx.DefaultErrorHandler$showErrorDialog$$inlined$apply$lambda$1$1$2$2$1.invoke(ErrorHandler.kt:15) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Call path from entry point to tornadofx.DefaultErrorHandler$showErrorDialog$$inlined$apply$lambda$1$1$2$2$1.invoke(Object): [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.DefaultErrorHandler$showErrorDialog$$inlined$apply$lambda$1$1$2$2$1.invoke(ErrorHandler.kt:15) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.App$trayicon$1.run(App.kt:181) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(generated:0) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.osgi.framework.FrameworkUtil. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time. [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Trace: [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at parsing tornadofx.osgi.impl.OSGISupportKt.getBundleId(OSGISupport.kt:27) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Call path from entry point to tornadofx.osgi.impl.OSGISupportKt.getBundleId(KClass): [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.osgi.impl.OSGISupportKt.getBundleId(OSGISupport.kt) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.FXKt.importStylesheet(FX.kt:393) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.App.<init>(App.kt:74) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.App.<init>(App.kt:62) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.App.<init>(App.kt:62) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at demo.LoginApp.<init>(MyMainApp.kt:20) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.reflect.LoginApp_constructor_1852ad38efbca670afe453f33b6139e1acb1c069_20.newInstance(Unknown Source) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at java.lang.reflect.Constructor.newInstance(Constructor.java:490) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$6(LauncherImpl.java:734) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.sun.javafx.application.LauncherImpl$$Lambda$542/0x00000007c1294040.run(Unknown Source) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(generated:0) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] com.oracle.svm.hosted.FallbackFeature$FallbackImageRequest: Aborting stand-alone image build. Unsupported features in 3 methods [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Detailed message: [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: javafx.scene.web.WebView. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time. [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Trace: [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at parsing tornadofx.ControlsKt.webview(Controls.kt:25) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Call path from entry point to tornadofx.ControlsKt.webview(EventTarget, Function1): [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.ControlsKt.webview(Controls.kt) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.DefaultErrorHandler$showErrorDialog$$inlined$apply$lambda$1$1$2$2.invoke(ErrorHandler.kt:96) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.DefaultErrorHandler$showErrorDialog$$inlined$apply$lambda$1$1$2$2.invoke(ErrorHandler.kt:15) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.App$trayicon$1.run(App.kt:181) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(generated:0) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: javafx.scene.web.WebView. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time. [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Trace: [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at parsing tornadofx.DefaultErrorHandler$showErrorDialog$$inlined$apply$lambda$1$1$2$2$1.invoke(ErrorHandler.kt:15) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Call path from entry point to tornadofx.DefaultErrorHandler$showErrorDialog$$inlined$apply$lambda$1$1$2$2$1.invoke(Object): [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.DefaultErrorHandler$showErrorDialog$$inlined$apply$lambda$1$1$2$2$1.invoke(ErrorHandler.kt:15) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.App$trayicon$1.run(App.kt:181) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(generated:0) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.osgi.framework.FrameworkUtil. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time. [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Trace: [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at parsing tornadofx.osgi.impl.OSGISupportKt.getBundleId(OSGISupport.kt:27) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Call path from entry point to tornadofx.osgi.impl.OSGISupportKt.getBundleId(KClass): [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.osgi.impl.OSGISupportKt.getBundleId(OSGISupport.kt) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.FXKt.importStylesheet(FX.kt:393) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.App.<init>(App.kt:74) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.App.<init>(App.kt:62) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.App.<init>(App.kt:62) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at demo.LoginApp.<init>(MyMainApp.kt:20) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.reflect.LoginApp_constructor_1852ad38efbca670afe453f33b6139e1acb1c069_20.newInstance(Unknown Source) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at java.lang.reflect.Constructor.newInstance(Constructor.java:490) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$6(LauncherImpl.java:734) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.sun.javafx.application.LauncherImpl$$Lambda$542/0x00000007c1294040.run(Unknown Source) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(generated:0) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.hosted.FallbackFeature.reportFallback(FallbackFeature.java:209) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:219) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:765) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:555) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:468) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Unsupported features in 3 methods [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Detailed message: [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: javafx.scene.web.WebView. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time. [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Trace: [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at parsing tornadofx.ControlsKt.webview(Controls.kt:25) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Call path from entry point to tornadofx.ControlsKt.webview(EventTarget, Function1): [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.ControlsKt.webview(Controls.kt) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.DefaultErrorHandler$showErrorDialog$$inlined$apply$lambda$1$1$2$2.invoke(ErrorHandler.kt:96) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.DefaultErrorHandler$showErrorDialog$$inlined$apply$lambda$1$1$2$2.invoke(ErrorHandler.kt:15) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.App$trayicon$1.run(App.kt:181) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(generated:0) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: javafx.scene.web.WebView. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time. [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Trace: [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at parsing tornadofx.DefaultErrorHandler$showErrorDialog$$inlined$apply$lambda$1$1$2$2$1.invoke(ErrorHandler.kt:15) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Call path from entry point to tornadofx.DefaultErrorHandler$showErrorDialog$$inlined$apply$lambda$1$1$2$2$1.invoke(Object): [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.DefaultErrorHandler$showErrorDialog$$inlined$apply$lambda$1$1$2$2$1.invoke(ErrorHandler.kt:15) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.App$trayicon$1.run(App.kt:181) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(generated:0) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.osgi.framework.FrameworkUtil. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time. [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Trace: [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at parsing tornadofx.osgi.impl.OSGISupportKt.getBundleId(OSGISupport.kt:27) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] Call path from entry point to tornadofx.osgi.impl.OSGISupportKt.getBundleId(KClass): [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.osgi.impl.OSGISupportKt.getBundleId(OSGISupport.kt) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.FXKt.importStylesheet(FX.kt:393) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.App.<init>(App.kt:74) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.App.<init>(App.kt:62) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at tornadofx.App.<init>(App.kt:62) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at demo.LoginApp.<init>(MyMainApp.kt:20) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.reflect.LoginApp_constructor_1852ad38efbca670afe453f33b6139e1acb1c069_20.newInstance(Unknown Source) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at java.lang.reflect.Constructor.newInstance(Constructor.java:490) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$6(LauncherImpl.java:734) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.sun.javafx.application.LauncherImpl$$Lambda$542/0x00000007c1294040.run(Unknown Source) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(generated:0) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:129) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:762) [Sun Aug 23 22:40:52 IST 2020][INFO] [SUB] ... 8 more [Sun Aug 23 22:40:54 IST 2020][INFO] [SUB] [demo.mymainappkt:21556] classlist: 1,323.28 ms, 0.96 GB [Sun Aug 23 22:40:55 IST 2020][INFO] [SUB] [demo.mymainappkt:21556] (cap): 731.10 ms, 0.96 GB [Sun Aug 23 22:40:56 IST 2020][INFO] [SUB] [demo.mymainappkt:21556] setup: 2,183.91 ms, 0.96 GB [Sun Aug 23 22:41:05 IST 2020][INFO] [SUB] [demo.mymainappkt:21556] (clinit): 115.72 ms, 1.20 GB [Sun Aug 23 22:41:05 IST 2020][INFO] [SUB] [demo.mymainappkt:21556] (typeflow): 4,825.33 ms, 1.20 GB [Sun Aug 23 22:41:05 IST 2020][INFO] [SUB] [demo.mymainappkt:21556] (objects): 3,616.62 ms, 1.20 GB [Sun Aug 23 22:41:05 IST 2020][INFO] [SUB] [demo.mymainappkt:21556] (features): 170.99 ms, 1.20 GB [Sun Aug 23 22:41:05 IST 2020][INFO] [SUB] [demo.mymainappkt:21556] analysis: 8,891.56 ms, 1.20 GB [Sun Aug 23 22:41:05 IST 2020][INFO] [SUB] [demo.mymainappkt:21556] universe: 393.88 ms, 1.21 GB [Sun Aug 23 22:41:07 IST 2020][INFO] [SUB] [demo.mymainappkt:21556] (parse): 1,132.61 ms, 1.21 GB [Sun Aug 23 22:41:08 IST 2020][INFO] [SUB] [demo.mymainappkt:21556] (inline): 1,113.11 ms, 1.66 GB [Sun Aug 23 22:41:15 IST 2020][INFO] [SUB] [demo.mymainappkt:21556] (compile): 6,755.07 ms, 2.25 GB [Sun Aug 23 22:41:15 IST 2020][INFO] [SUB] [demo.mymainappkt:21556] compile: 9,595.30 ms, 2.25 GB [Sun Aug 23 22:41:16 IST 2020][INFO] [SUB] [demo.mymainappkt:21556] image: 929.94 ms, 2.25 GB [Sun Aug 23 22:41:16 IST 2020][INFO] [SUB] [demo.mymainappkt:21556] write: 178.09 ms, 2.25 GB [Sun Aug 23 22:41:16 IST 2020][INFO] [SUB] [demo.mymainappkt:21556] [total]: 23,762.41 ms, 2.25 GB [Sun Aug 23 22:41:16 IST 2020][INFO] [SUB] Warning: Image 'demo.mymainappkt' is a fallback image that requires a JDK for execution (use --no-fallback to suppress fallback image generation and to print more detailed information why a fallback image was necessary). [Sun Aug 23 22:41:16 IST 2020][INFO] Additional information: Objectfile should be called demo.mymainappkt.o but we didn't find that under /home/anindya/codebase/tornadofx-demo/demo/target/client/x86_64-linux/gvm [Sun Aug 23 22:41:16 IST 2020][SEVERE] Compiling failed. Check the log files under /home/anindya/codebase/tornadofx-demo/demo/target/client/x86_64-linux/gvm/log And please check https://docs.gluonhq.com/client/ for more information. [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:30 min [INFO] Finished at: 2020-08-23T22:41:16+05:30 [INFO] Final Memory: 36M/140M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.gluonhq:client-maven-plugin:0.1.31:compile (default-cli) on project mainModule: Compiling failed -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:32 min [INFO] Finished at: 2020-08-23T22:41:16+05:30 [INFO] Final Memory: 11M/54M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.gluonhq:client-maven-plugin:0.1.31:build (default-cli) on project mainModule: Error, client:build failed -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
You should add the missing dependencies to your pom. Of still it doesn't work you might want to use <nativeImageArgs/>
with -H:+AllowIncompleteClasspath
and --no-fallback
OK I have added missing dependencies like javafx-web and org.osgi.framework, the build passed without adding any native image args. But when I try to run it, I am getting below error
Exception in Application start method Exception in Application stop method Aug 23, 2020 11:01:55 PM tornadofx.DefaultErrorHandler uncaughtException SEVERE: Uncaught error java.lang.RuntimeException: Exception in Application start method at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195) at java.lang.Thread.run(Thread.java:834) at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:517) at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192) Caused by: java.lang.ExceptionInInitializerError at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:291) at demo.LoginScreen$root$1$1$1$1.invoke(MyMainApp.kt:111) at demo.LoginScreen$root$1$1$1$1.invoke(MyMainApp.kt:96) at tornadofx.ControlsKt.textfield(Controls.kt:101) at demo.LoginScreen$root$1$1$1.invoke(MyMainApp.kt:109) at demo.LoginScreen$root$1$1$1.invoke(MyMainApp.kt:96) at tornadofx.FormsKt.field(Forms.kt:56) at tornadofx.FormsKt.field$default(Forms.kt:53) at demo.LoginScreen$root$1$1.invoke(MyMainApp.kt:108) at demo.LoginScreen$root$1$1.invoke(MyMainApp.kt:96) at tornadofx.FormsKt.fieldset(Forms.kt:346) at tornadofx.FormsKt.fieldset$default(Forms.kt:25) at demo.LoginScreen$root$1.invoke(MyMainApp.kt:107) at demo.LoginScreen$root$1.invoke(MyMainApp.kt:96) at tornadofx.FormsKt.form(Forms.kt:342) at demo.LoginScreen.<init>(MyMainApp.kt:105) at java.lang.reflect.Constructor.newInstance(Constructor.java:490) at java.lang.Class.newInstance(DynamicHub.java:855) at tornadofx.FXKt.find(FX.kt:434) at tornadofx.FXKt.find$default(FX.kt:423) at tornadofx.App.start(App.kt:83) at demo.LoginApp.start(MyMainApp.kt:24) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846) at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455) at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428) at java.security.AccessController.doPrivileged(AccessController.java:101) at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96) at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(JNIJavaCallWrappers.java:0) at com.sun.glass.ui.gtk.GtkApplication._runLoop(GtkApplication.java) at com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277) ... 3 more Caused by: java.util.MissingResourceException: Resource bundle not found tornadofx/i18n/ViewModel. Register the resource bundle using the option -H:IncludeResourceBundles=tornadofx/i18n/ViewModel. at com.oracle.svm.core.jdk.LocalizationSupport.getCached(LocalizationSupport.java:66) at java.util.ResourceBundle.getBundle(ResourceBundle.java:53) at tornadofx.ViewModelKt.<clinit>(ViewModel.kt:25) at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:351) at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:271) ... 33 more
Just read the stack traces...
Caused by: java.util.MissingResourceException: Resource bundle not found tornadofx/i18n/ViewModel. Register the resource bundle using the option -H:IncludeResourceBundles=tornadofx/i18n/ViewModel.
You can simple use <resourcesList/>
to add tornadofx/i18n/ViewModel
I had to add the resource bundle details to native image args like below
<nativeImageArgs>
<list>-H:IncludeResourceBundles=tornadofx/i18n/ViewModel</list>
<list>-H:IncludeResourceBundles=tornadofx/i18n/Wizard</list>
</nativeImageArgs>
Don't know how, but adding them to the resourcesList does not make any difference. I also had to add some other classes to reflectionList. Finally the app is opening. Here is the final pom.xml for future reference.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>mainModule</artifactId>
<groupId>me.anindya</groupId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mainModule</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.code.style>official</kotlin.code.style>
<kotlin.compiler.jvmTarget>11</kotlin.compiler.jvmTarget>
<mainClassName>demo.MyMainAppKt</mainClassName>
</properties>
<repositories>
<repository>
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
</repositories>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<mainClass>demo.MyMainAppKt</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>client-maven-plugin</artifactId>
<version>0.1.31</version>
<configuration>
<mainClass>${mainClassName}</mainClass>
<reflectionList>
<list>demo.LoginApp</list>
<list>demo.LoginController</list>
<list>demo.LoginScreen</list>
<list>demo.SecureScreen</list>
<list>demo.Styles</list>
<list>tornadofx.TaskStatus</list>
</reflectionList>
<nativeImageArgs>
<list>-H:IncludeResourceBundles=tornadofx/i18n/ViewModel</list>
<list>-H:IncludeResourceBundles=tornadofx/i18n/Wizard</list>
</nativeImageArgs>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit</artifactId>
<version>1.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>no.tornado</groupId>
<artifactId>tornadofx</artifactId>
<version>1.7.20</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.framework</artifactId>
<version>1.9.0</version>
</dependency>
</dependencies>
<pluginRepositories>
<pluginRepository>
<id>gluon-releases</id>
<url>http://nexus.gluonhq.com/nexus/content/repositories/releases/</url>
</pluginRepository>
</pluginRepositories>
</project>
Thanks @jperedadnr for your continual support..
Good that it works now.
My bad before: Regular resource files go to <resourcesList/>
, but resource bundles go to <bundlesList/>
, so this should work:
<bundlesList>
<list>tornadofx/i18n/ViewModel</list>
<list>tornadofx/i18n/Wizard</list>
</bundlesList>
Can a Kotlin/TornadoFX project be compiled with substrate to generate native image?