Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalStateException running NetBeans Modular Maven project #39

Open
jgneff opened this issue Oct 20, 2019 · 0 comments · May be fixed by #40
Open

IllegalStateException running NetBeans Modular Maven project #39

jgneff opened this issue Oct 20, 2019 · 0 comments · May be fixed by #40

Comments

@jgneff
Copy link

jgneff commented Oct 20, 2019

The NetBeans Modular Maven sample project fails to run and prints the exception shown below:

$ mvn clean javafx:jlink
...
[INFO] BUILD SUCCESS
...
$ target/hellofx/bin/launcher 
Exception in Application start method
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:567)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
	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:567)
	at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Exception in Application start method
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
	at java.base/java.lang.Thread.run(Thread.java:830)
Caused by: java.lang.IllegalStateException: Location is not set.
	at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2459)
	at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435)
	at hellofx@1.0-SNAPSHOT/org.openjfx.hellofx.App.loadFXML(App.java:32)
	at hellofx@1.0-SNAPSHOT/org.openjfx.hellofx.App.start(App.java:20)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
	at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
	at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
	... 1 more
Exception running application org.openjfx.hellofx.App

The same error occurs when the application is launched from the IDE or with the command mvn clean javafx:run. I'm running under the following environment:

#!/bin/bash
# Sets up the environment for building JavaFX applications
syspath=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# JavaFX Linux SDK and JMODs
export JAVAFX_SDK=$HOME/lib/javafx-sdk-13/lib
export JAVAFX_JMODS=$HOME/lib/javafx-jmods-13

export JAVA_HOME=$HOME/opt/jdk-13.0.1
export ANT_HOME=$HOME/opt/apache-ant-1.10.7
export GRADLE_HOME=$HOME/opt/gradle-6.0-rc-1
export PATH=$GRADLE_HOME/bin:$ANT_HOME/bin:$JAVA_HOME/bin:$syspath

I will follow up shortly with a pull request that fixes the problem.

jgneff added a commit to jgneff/samples that referenced this issue Oct 20, 2019
Fix two errors in package names:

1. java.lang.IllegalStateException: Location is not set.

The application loads the FXML resources relative to its own package
org.openjfx.hellofx, but the resources are not found because they are in
a different package, org.openjfx. The fix is either to get the resources
using their absolute names, such as "/org/openjfx/primary.fxml", or to
change their package name to org.openjfx.hellofx. This fix changes the
package name.

2. java.lang.module.InvalidModuleDescriptorException:
     Package org.openjfx not found in module

The FXML classes use reflection to load the controllers in
org.openjfx.hellofx, but only the package org.openjfx, which contains no
code, is open to it. Fix the module descriptor to open the correct
package name of org.openjfx.hellofx.

Fixes openjfx#39
@jgneff jgneff linked a pull request Oct 20, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant