Home > other >  Migrating Swing application to Java 8 causes java.lang.ClassNotFoundException: org.jdesktop.swingwor
Migrating Swing application to Java 8 causes java.lang.ClassNotFoundException: org.jdesktop.swingwor

Time:09-23

Facing an issue while migrating Swing Application developed on JDK 6 to JDK 8 causes the below issue:

java.lang.NoClassDefFoundError: org/jdesktop/swingworker/SwingWorker
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
    at java.lang.Class.getMethod0(Class.java:3018)
    at java.lang.Class.getMethod(Class.java:1784)
    at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
    at com.sun.javaws.Launcher.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: org.jdesktop.swingworker.SwingWorker
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at com.sun.jnlp.JNLPClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 8 more

The application is using JNLP for the dependencies.

JNLP configuration:

<?xml version="1.0" encoding="utf-8"?>
<jnlp       spec="1.6 "     codebase="http://SERVER_NAME:8080/jnlp/" href="test.jnlp">
    <information>
        <title>Test</title>
        <vendor>ABC</vendor>
        <offline-allowed/>
    </information>
    <security>
        <all-permissions/>
    </security>
    <update check="always" policy="always" />
    <resources>
        <j2se version="1.6*" max-heap-size="512M" initial-heap-size="256m" href="http://java.sun.com/products/autodl/j2se" />
        <property name="weblogic.MaxMessageSize" value="2000000000"/>
        <!-- Environment -->
        <property name="env" value="test"/>
        <!-- SSO authentication parameters for DEBUGGING -->
        <property name="abc.xyx.debug" value="true"/>
        <property name="aaaa.rrrr.debug" value="true"/>
        <property name="tttt.rrrr.eee.enable" value="true"/>
        <jar href="libs/test-SNAPSHOT.jar" main="true"/>
        ..........SOME OTHER JAR's
        <jar href="libs/swingx-0.9.5.jar"/>
        <jar href="libs/swing-worker-1.1.jar"/>
       
    </resources>
    <resources os="Windows" arch="x86">
        <nativelib href="libs/XYZ-1.0.jar"/>
    </resources>
    <application-desc main-class="com.example.Login" />
</jnlp>

Anybody can help in this or suggest what are changes/improvement made in the JDK 8 regarding JNLP and Java Web Start.

Tech stack used: Java 8, Web Logic 12c

Thanks in advance :)

CodePudding user response:

According to Wikipedia, org.jdesktop.swingworker.SwingWorker is a backport of the javax.swing.SwingWorker class introduced in Java 6.

The image

  • Related