I'm attempting to convert a rather complex application that uses several modules into using webstart instead of the C# equivalent. (I'm aware that webstart is deprecated and is going away. This is a temporary solution) I am using maven-webstart-plugin and seem to be running into a problem where I get a ClassNotFoundException when it tries to load Java-Websockets library. The problem is that websockets are included in the POM file of one of the app modules (I even tried to add it as an explicit dependency in the main application). It does get in the JNLP file and it is definitely in the lib folder generated by the webstart plugin so I'm pretty stumped as to why it can't find it. Any help would be greatly appreciated. I have tried everything I could think of (explicit dependency in the main project, moving the call to websockets into the main app - It just moved the exception to there). I also enabled the Java Debugger so the console appears when the webpage JNLP loads and I do see it load the WebSocket JAR:
Exception:
java.lang.ClassNotFoundException: org.java_websocket.client.WebSocketClient
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.joy.system.SystemAppLaunch.main(SystemAppLaunch.java:329)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Console Output:
Java Web Start 11.181.2.13 x86
Using JRE version 1.8.0_181-b13 Java HotSpot(TM) Client VM
User home directory = C:\Users\user
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
0-5: set trace level to <n>
----------------------------------------------------
CacheEntry[file:/C:/Users/user/Desktop/Alpha/apache-tomcat-9.0.0.M26/webapps/FB2HMI/lib/Java-WebSocket-1.3.0.jar]: updateAvailable=false,lastModified=Mon Nov 26 11:39:44 EST 2018,length=113538
Sep 11 15:24:07 EDT 2018,length=12913
System Application is started. Please wait......
#### Java Web Start Error:
#### org.java_websocket.client.WebSocketClient
JNLP File:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="" href="launch.jnlp">
<information>
<title>SystemApp</title>
<vendor></vendor>
<homepage href=""/>
<description>System Application</description>
<icon kind="splash" href="kom.jpeg"/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.7+"/>
<jar href="lib/DaExecutive.jar"/>
<jar href="lib/SystemApp-10.0.60.jar" main="true"/>
<jar href="lib/DDS-10.0.60.jar"/>
<jar href="lib/jackson-core-2.2.3.jar"/>
<jar href="lib/jackson-coreutils-1.8.jar"/>
<jar href="lib/msg-simple-1.1.jar"/>
<jar href="lib/btf-1.2.jar"/>
<jar href="lib/jackson-databind-2.2.3.jar"/>
<jar href="lib/guava-16.0.1.jar"/>
<jar href="lib/jsr305-2.0.1.jar"/>
<jar href="lib/json-schema-core-1.2.5.jar"/>
<jar href="lib/uri-template-0.9.jar"/>
<jar href="lib/rhino-1.7R4.jar"/>
<jar href="lib/json-schema-validator-2.2.6.jar"/>
<jar href="lib/joda-time-2.3.jar"/>
<jar href="lib/libphonenumber-6.2.jar"/>
<jar href="lib/mailapi-1.4.3.jar"/>
<jar href="lib/activation-1.1.jar"/>
<jar href="lib/jopt-simple-4.6.jar"/>
<jar href="lib/Utilities-10.0.60.jar"/>
<jar href="lib/zip4j-1.2.3.jar"/>
<jar href="lib/jackson-dataformat-xml-2.9.5.jar"/>
<jar href="lib/jackson-annotations-2.9.0.jar"/>
<jar href="lib/jackson-module-jaxb-annotations-2.9.5.jar"/>
<jar href="lib/stax2-api-3.1.4.jar"/>
<jar href="lib/woodstox-core-5.0.3.jar"/>
<jar href="lib/Carousel-10.0.60.jar"/>
<jar href="lib/CoreControls-10.0.60.jar"/>
<jar href="lib/CommonInterface-1.0.0.jar"/>
<jar href="lib/log4j-1.2.17.jar"/>
<jar href="lib/json-20090211.jar"/>
<jar href="lib/gson-1.4.jar"/>
<jar href="lib/commons-io-2.4.jar"/>
<jar href="lib/jna-4.1.0.jar"/>
<jar href="lib/platform-3.4.0.jar"/>
<jar href="lib/TableLayout-20050920.jar"/>
<jar href="lib/CoreHMIAppBuilder-10.0.60.jar"/>
<jar href="lib/Fb2HmiCm-10.0.64.jar"/>
<jar href="lib/commons-collections4-4.0.jar"/>
<jar href="lib/CoreStandardFeatures-10.0.60.jar"/>
<jar href="lib/commons-net-3.6.jar"/>
<jar href="lib/Java-WebSocket-1.3.0.jar"/>
<jar href="lib/commons-configuration-1.6.jar"/>
<jar href="lib/commons-collections-3.2.1.jar"/>
<jar href="lib/commons-lang-2.4.jar"/>
<jar href="lib/commons-logging-1.1.1.jar"/>
<jar href="lib/commons-digester-1.8.jar"/>
<jar href="lib/commons-beanutils-1.7.0.jar"/>
<jar href="lib/commons-beanutils-core-1.8.0.jar"/>
<property name="jnlp.serverip" value="192.168.0.50"/>
<property name="jnlp.serverport" value="8080"/>
</resources>
<application-desc main-class="com.joy.system.SystemAppLaunch" name="SystemApp">
<argument>8887</argument>
<argument>192.168.0.50</argument>
</application-desc>
</jnlp>
My POM file is as follows (for the main application module):
<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/xsd/maven-4.0.0.xsd">
<parent>
<groupId>ParentProject</groupId>
<artifactId>ParentProject</artifactId>
<version>10.0.60</version>
<relativePath>../ParentProject/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>SystemApp</groupId>
<artifactId>SystemApp</artifactId>
<name>SystemApp</name>
<description>System Application</description>
<dependencies>
<dependency>
<groupId>DDS</groupId>
<artifactId>DDS</artifactId>
<version>${dds-version}</version>
</dependency>
<dependency>
<groupId>utility</groupId>
<artifactId>Utilities</artifactId>
<version>${utilities-version}</version>
</dependency>
<dependency>
<groupId>Carousel</groupId>
<artifactId>Carousel</artifactId>
<version>${carousel-version}</version>
</dependency>
<dependency>
<groupId>CoreControls</groupId>
<artifactId>CoreControls</artifactId>
<version>${coreControls-version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>platform</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>tablelayout</groupId>
<artifactId>TableLayout</artifactId>
<version>20050920</version>
</dependency>
<dependency>
<groupId>CoreHMIAppBuilder</groupId>
<artifactId>CoreHMIAppBuilder</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Tell maven to compile using Java 1.8 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<fork>true</fork>
<executable>${JAVA_1_8_HOME}</executable>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>webstart-maven-plugin</artifactId>
<version>1.0-beta-6</version>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>keytool-api-1.7</artifactId>
<version>1.5</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jnlp-inline</goal>
</goals>
</execution>
</executions>
<configuration>
<excludeTransitive>false</excludeTransitive>
<makeArchive>false</makeArchive>
<filenameMapping>simple</filenameMapping>
<versionEnabled>false</versionEnabled>
<jnlpFiles>
<jnlpFile>
<templateFilename>template.vm</templateFilename>
<outputFilename>launch.jnlp</outputFilename>
<jarResources>
<jarResource>
<groupId>SystemApp</groupId>
<artifactId>SystemApp</artifactId>
<name>SystemApp</name>
<version>${project.version}</version>
<mainClass>com.joy.system.SystemAppLaunch</mainClass>
</jarResource>
</jarResources>
</jnlpFile>
</jnlpFiles>
<unsignAlreadySignedJars>true</unsignAlreadySignedJars>
<canUnsign>true</canUnsign>
<libPath>lib</libPath>
<codebase></codebase>
<updateManifestEntries>
<Application-Name>SystemApp</Application-Name>
<Class-Path>resources/ resources/images/ resources/properties/ resources/config/</Class-Path>
<Trusted-Library>true</Trusted-Library>
<Permissions>all-permissions</Permissions>
<Codebase>*</Codebase>
<Trusted-Only>true</Trusted-Only>
</updateManifestEntries>
<jnlp>
<j2seVersion>1.7+</j2seVersion>
<outputFile>launch.jnlp</outputFile>
<mainClass>com.joy.system.SystemAppLaunch</mainClass>
</jnlp>
<sign>
<keystore>${project.basedir}/myKeystore.jks</keystore>
<storepass>password</storepass>
<alias>key_2017</alias>
<verify>false</verify>
</sign>
<verbose>true</verbose>
</configuration>
</plugin>
</plugins>
</build>
</project>
If anyone comes across this what I had done was manually add a separate JAR that I needed within the application to the top of the template list of jars. You can see it in my above JNLP file as DaExecutive.jar. There is an issue with that, that I haven't resolved yet, but it was preventing all the .jar dependencies below it in the list from loading. Removing that allowed them to load.