2

I am now trying to deploy a Java application with Java Web Start. The application works fine when running standalone. I exported the project as a runnable .jar file, and then wrote the corresponding jnlp file.

However, when running from the jnlp file, the application returns the following error when starting up:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: someClass
........
Caused by: java.lang.ClassNotFoundException: someClass
.........

I exported the .jar file using Eclipse Helios with the option "Package required libraries into generated JAR".

Here's what my jnlp file looks like (I substituted some information):

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" 
    codebase="................" 
    href="thisJNLP.jnlp">
    <information>
        <title>Whatever</title>
        <vendor>Whatever</vendor>
    </information>
    <security>
        <all-permissions/>
    </security>

    <resources>
        <!-- Application Resources -->
        <j2se version="1.6+"
              href="http://java.sun.com/products/autodl/j2se"/>
        <jar href="signed.jar" main="true" />

    </resources>
    <application-desc
         name="Whatever"
         main-class="thisProject.main"
         width="300"
         height="300">
     </application-desc>
     <update check="background"/>
</jnlp>

In addition, I am using WebLogic 10 to host the files, but I doubt that will make any difference.

Could someone help me out?

Thanks for any inputs!

2
  • So you tried the exact same jar standalone, i.e. starting it from the command line? Sure that all required classes are in the JAR? Commented Jul 7, 2011 at 14:55
  • @Thomas Yes, it runs fine when standalone. Commented Jul 7, 2011 at 14:57

1 Answer 1

1

From the WebStart Developer's Guide:

All application resources must be retrieved from the JAR files specified in the resources section of the JNLP file, or retrieved explicitly using an HTTP request to the Web server. Storing resources in JAR files is recommended, since they will be cached on the local machine by Java Web Start.

So the class loader mechanism is different for WebStart applications. I assume it's the packaging option "Package required libraries into generated JAR" that causes problems in your case.

Is the class someClasscontained in a jar that is contained within your signed.jar file? If so, this would back this theory - try generating separate jar files (don't forget to sign them all!) and reference each of them in the <resources> section as a separate <jar> entry.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the answer! I think this should be the cause, and I will check... p.s. Sorry for the edit but I just took out the information of my program, which I forgot to remove.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.