IllegalAccessError: class impl.org.controlsfx.version.VersionChecker (in unnamed module) cannot access class com.sun.javafx.runtime.VersionInfo (in module javafx.base) because module javafx.base does not export com.sun.javafx.runtime to unnamed module

Issue #783 new
Fouad Almalki
created an issue

The following exception occurs when using NotificationPane through Webstart (works fine in normal environment):

Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessError: class impl.org.controlsfx.version.VersionChecker (in unnamed module @0x79b4759) cannot access class com.sun.javafx.runtime.VersionInfo (in module javafx.base) because module javafx.base does not export com.sun.javafx.runtime to unnamed module @0x79b4759
    at impl.org.controlsfx.version.VersionChecker.<clinit>(VersionChecker.java:50)
    at org.controlsfx.control.ControlsFXControl.<init>(ControlsFXControl.java:35)
    at org.controlsfx.control.NotificationPane.<init>(NotificationPane.java:208)
    at org.controlsfx.control.NotificationPane.<init>(NotificationPane.java:194)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.base/java.lang.Class.newInstance(Unknown Source)
    at javafx.fxml/javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(Unknown Source)
    at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processStartElement(Unknown Source)
    at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(Unknown Source)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
    at javafx.fxml/javafx.fxml.FXMLLoader.load(Unknown Source)
    /* unrelated lines removed */
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$9(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)

Comments (4)

  1. Fouad Almalki reporter

    I tried to bypass the bug temporarily by fixing the version inside impl.org.controlsfx.version.VersionChecker:

    javaFXVersion         = "9";
    

    However, I got a new exception:

    com.sun.javafx.scene.traversal.ParentTraversalEngine (in module javafx.graphics) because module javafx.graphics does not export  com.sun.javafx.scene.traversal to unnamed module @0x6bc89e63
        at impl.org.controlsfx.skin.NotificationPaneSkin.<init>(NotificationPaneSkin.java:117)
        at org.controlsfx.control.NotificationPane.createDefaultSkin(NotificationPane.java:225)
        at javafx.controls/javafx.scene.control.Control.doProcessCSS(Control.java:897)
        at javafx.controls/javafx.scene.control.Control.access$000(Control.java:83)
        at javafx.controls/javafx.scene.control.Control$1.doProcessCSS(Control.java:89)
        at javafx.controls/com.sun.javafx.scene.control.ControlHelper.processCSSImpl(ControlHelper.java:67)
        at javafx.graphics/com.sun.javafx.scene.NodeHelper.processCSS(NodeHelper.java:147)
        at javafx.graphics/javafx.scene.Node.processCSS(Node.java:9513)
        at javafx.graphics/javafx.scene.Node.processCSS(Node.java:9506)
        at javafx.graphics/javafx.scene.Node.processCSS(Node.java:9506)
        at javafx.graphics/javafx.scene.Scene.doCSSPass(Scene.java:583)
        at javafx.graphics/javafx.scene.Scene.access$3500(Scene.java:173)
        at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2502)
        at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$runPulse$3(Toolkit.java:366)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:365)
        at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:392)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:518)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:498)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:491)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:319)
        at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
        at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:189)
        at java.base/java.lang.Thread.run(Thread.java:844)
    

    Again, this happens on webstart environment only.

  2. Abhinay Agarwal

    How do you create the WebStart? Do you use a gradle plugin or is it a manual process? If you layout the steps, may be I can try to reproduce the problem and suggest a solution for the same.

    Right now, most of the inaccessible packages are exported. Check the compile time args used to compile the project and also the runtime args used to run the sample application.

  3. Tobias Schulte

    You can use the following changes to create a webstart launcher:

    diff -r faac7afb953d controlsfx-samples/build.gradle
    --- a/controlsfx-samples/build.gradle   Sat Oct 21 15:55:05 2017 +0200
    +++ b/controlsfx-samples/build.gradle   Thu Nov 30 16:00:52 2017 +0100
    @@ -1,3 +1,6 @@
    +plugins {
    +    id "de.gliderpilot.jnlp" version "1.2.5"
    +}
     apply plugin: 'application'
    
     applicationName = 'FXSampler'
    @@ -44,3 +47,21 @@
         // For accessing InputMap used in RangeSliderBehavior
         "--add-exports=javafx.controls/com.sun.javafx.scene.control.inputmap=ALL-UNNAMED"
     ]
    +
    +jnlp {
    +    // create key on the commandline:
    +    // `keytool -genkey -storepass storepass -alias mykey -dname "CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown"`
    +    signJarParams = [
    +        alias: 'mykey',
    +        storepass: "storepass",
    +    ]
    +    usePack200 = false
    +    j2seParams = [version: "9", "java-vm-args": applicationDefaultJvmArgs.join(" ")]
    +    withXml {
    +        information {
    +            title project.name
    +            vendor project.group
    +        }
    +        security { "all-permissions"() }
    +    }
    +}
    

    You need to generate a certificate in your keystore first by using keytool -genkey -storepass storepass -alias mykey -dname "CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown". You also need to add a security exception in the "Java Control Panel", tab "Security", click "Edit Site List", add "file:///".

    Then you can create the launcher with ./gradlew build. After that you can start the sample application with javaws controlsfx-samples/build/jnlp/launch.jnlp. It did not start on my machine. Only after adding

        // For VersionInfo
        "--add-exports=javafx.base/com.sun.javafx.runtime=ALL-UNNAMED",
        // For ReflectionUtils
        "--add-opens=javafx.graphics/com.sun.javafx.css=ALL-UNNAMED",
    

    to applicationDefaultJvmArgs, the application starts (you need to excecute ./gradlew cleanGenerateJnlp after such changes, because the generateJnlp task is not save in that regard yet.

  4. Log in to comment