3 Replies Latest reply on Mar 30, 2012 4:01 PM by 802471

    JNLP throws java.lang.NoClassDefFoundError

    802471
      Hello,

      I started playing around with Web Start and got it running with a simple app, which just shows a empty frame. Now when I tried to run more complex app with libraries I get the error:

      java.lang.NoClassDefFoundError: org/apache/commons/httpclient/HttpException
           at java.lang.Class.getDeclaredMethods0(Native Method)
           at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
           at java.lang.Class.getMethod0(Unknown Source)
           at java.lang.Class.getMethod(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)
      Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.HttpException
           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 java.lang.ClassLoader.loadClass(Unknown Source)
           ... 9 more

      The HttpException should be in the commons-httpclient.jar listed in the jnlp. My .jnlp file is:
      <?xml version="1.0" encoding="UTF-8"?>
      <jnlp href="launch.jnlp" spec="1.0+" codebase="https://localhost:8443/mytest/">
           <information>
                <title>MyTest</title>
                <vendor>A Company, Inc.</vendor>
                <description>MyTest</description>
                <description kind="short">MyTest</description>
           </information>
           <update check="always"/>
           <security>
                <all-permissions/>
           </security>
           <resources>
                <!--<j2se version="1.6+"/>-->
                <jar href="MyTest.jar" main="true"/>
                <jar href="lib/MyLibrary.jar"/>
                <jar href="lib/nachocalendar-0.23.jar"/>
                <jar href="lib/antlr.jar"/>
                <jar href="lib/commons-httpclient-contrib.jar"/>
                <jar href="lib/commons-httpclient.jar"/>
                <jar href="lib/commons-logging.jar"/>
                <jar href="lib/commons-transaction-1.0.jar"/>
                <jar href="lib/jakarta-slide-commandline-2.1.jar"/>
                <jar href="lib/jakarta-slide-webdavlib-2.1.jar"/>
                <jar href="lib/jdom-1.0.jar"/>
                <jar href="lib/xml-im-exporter1.1.jar"/>
                <jar href="lib/postgresql-9.1-901.jdbc4.jar"/>
           </resources>
           <application-desc main-class="nt.gui.LoginScreenGUI">
           </application-desc>
      </jnlp>
      My error is something similar to Re: Extra jar fetched but not loaded ? but the post doesn't seem to have a solution. I'm currently using Tomcat 7 as the webserver and running JDK 1.6.0_31. Any help would be much appreciated. Thanks.