0

been 3 weeks puzzling.. so I know jlink, jdeps and jpackage fairly well.. but not how jpackage works internally with, in this case Mac... but I also get same deal on Win10 with the Win 10x64 openjdk/fx environment also.. I have exhausted all (i think) of the red herrings in this puzzle.,

so jar runs fine in the openjdk15 bin directory.. but when i jpackage and open the install mac app (after a pkg install) .. then I get complaints of a missing module (as if it may be hitting say an xcode old jre or something BEFORE it gets to the jdk on either the runtime I built or the on-path jdk .. all openjdk 15.0.1.

So its something that jpackage does internally in the executable contents thats built that doesnt call the jar correctly (even if I dont use jlink and jpackage it with just add-modules for fx jmods hitting the on path mvn jdk.. also openjdk15.0.1)

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(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: javax/naming/NamingException
at com.mongodb.ConnectionString.<init>(ConnectionString.java:378)
at com.mongodb.client.MongoClients.create(MongoClients.java:61)
at org.crob.MongoConnection.getMongo(MongoConnection.java:36)
at org.crob.MongoConnection.init(MongoConnection.java:85)
at org.crob.PrimaryController.initialize(PrimaryController.java:279)
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)
at org.crob.App.loadFXML(App.java:77)
at org.crob.App.start(App.java:28)
at 
javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javax.naming.NamingException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 16 more
Exception running application org.crob.App

[Process completed]

jpackage in comments..

jdeps..

./jdeps --print-module-deps --ignore-missing-deps /Users/johnallen/Downloads/input/modsim-1.0-SNAPSHOT.jar
java.base,java.compiler,java.desktop,java.instrument,java.management,java.naming,java.scripting,java.security.jgss,java.security.sasl,java.sql,jdk.jfr,jdk.unsupported

and when i did build a runtime..

 ./jlink --output /Users/johnallen/Downloads/jd15fx15modsimruntime-mvn-ver --module-path /Users/johnallen/Downloads/javafx-jmods-15.0.1 --add-modules javafx.controls,javafx.fxml,java.base,java.compiler,java.desktop,java.instrument,java.management,java.naming,java.scripting,java.security.jgss,java.security.sasl,java.sql,jdk.jfr,jdk.unsupported

and of course runs just fine as a .jar call from the jdk15.0.1 folder

./Users/johnallen/downloads/jdk-15.0.1.jdk/Contents/Home/bin/java --module-path /Users/johnallen/Downloads/javafx-sdk-15.0.1/lib --add-modules=javafx.controls,javafx.fxml -jar /Users/johnallen/Downloads/input/modsim-1.0-SNAPSHOT.jar

POM
<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.crob</groupId>
<artifactId>modsim</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
    <project.build.sourceEncoding>UTF- 
 8</project.build.sourceEncoding>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-controls</artifactId>
        <version>15.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-fxml</artifactId>
        <version>15.0.1</version>
    </dependency>

    <dependency>
        <groupId>com.hedera.hashgraph</groupId>
        <artifactId>sdk</artifactId>
        <version>1.2.0</version>
    </dependency>

    <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-netty-shaded</artifactId>
        <version>1.31.1</version>
    </dependency>
    <dependency>
        <groupId>dev.morphia.morphia</groupId>
        <artifactId>morphia-core</artifactId>
        <version>2.0.2</version>
    </dependency>

    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongo-java-driver</artifactId>
        <version>3.12.7</version>
    </dependency>

    <!--<dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-graphics</artifactId>
        <version>16-ea+2</version> to comment out this line!
        <version>15.0.1</version>
    </dependency>-->

    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.2.4</version>
        <type>maven-plugin</type>
    </dependency>

</dependencies>
<build>
    <plugins>
        <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>org.openjfx</groupId>
            <artifactId>javafx-maven-plugin</artifactId>
            <version>0.0.4</version>
            <configuration>
                <mainClass>org.crob.App</mainClass>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.2.4</version>

            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <transformers>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>org.crob.App</mainClass>
                            </transformer>                                    <mainClass>org.crob.App</mainClass>
                            </transformer>
                        </transformers>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
 </build>
 </project>
johnda98
  • 1
  • 2
  • Guys.. I have everything.. .pom. etc.. will add as file.. I'm a noob to stackovflw.. I dont ask directions very often ! lol. but need help on this puppy. I seems its a openjdk/javafx JRE and the runtime not having a module that the uber java-mongodb-driver dependency seeks.. to do with the URL/URI connect string.. thats were its falling over .. but I tried building a jlink runtime in 15.0.1 with ALL the jdeps I found in my shaded uber jar of the DApp (that BTW work just fine on mac when I java - jar it with the fxmods from the 15.0.1fx sdk lib dir ) – johnda98 Jan 30 '21 at 14:27
  • So basically when i jpackage from 15.0.1 bin location ./jpackage --type pkg --name modsim --description 'Modeler Simulator' --app-version '1.0.0' --vendor 'Charles R' --input /Users/johnallen/Downloads/input --dest /Users/johnallen/Downloads/output --main-jar modsim-1.0-SNAPSHOT.jar --main-class org.crob.App --icon /Users/johnallen/Downloads/input/modsim.icns --module-path /Users/johnallen/Downloads/javafx-jmods-11.0.2 --add-modules javafx.controls,javafx.fxml". – johnda98 Jan 30 '21 at 14:37
  • So yep I use mvn plugin in eclipse .. all dandy fine.. then a mvn package in the project folder to get my shaded jar.. yep and that pup runs fine!.. jpackage call from within jdk15..with module path to the fx15 mods.. just dandy.. installs fine.. then throws when i click the new app or run from its package (to get the stack trace).. also happens on windows.. havnt tried on ubuntu19 yet (but it runs fine there and installs ok as a deb etc).. – johnda98 Jan 30 '21 at 14:58
  • PROGRESS.. jdeps on the jar was not giving me jdk.naming.dns.. NOW it runs from the .jar in the jlink created runtime but ONLY with these java options. --add-exports=jdk.naming.dns/com.sun.jndi.dns=java.naming. its related to JNDI issue https://github.com/quarkusio/quarkus/issues/7986 – johnda98 Jan 31 '21 at 22:13
  • running that -add-exports' to jpackage now..using that new runtime as prior comment. – johnda98 Jan 31 '21 at 22:14
  • yes solved it.. well with the help of that runtime option.. jpackage feeds it .. essentially a mongo prob – johnda98 Jan 31 '21 at 22:50

0 Answers0