File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JNLP and Web Start and the fly likes Spring Jar files - Can not find class def Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "Spring Jar files - Can not find class def" Watch "Spring Jar files - Can not find class def" New topic

Spring Jar files - Can not find class def

Mike Wesley

Joined: Apr 12, 2012
Posts: 1

I have a simple swing webstart demo that worked great using the .jnlp file. Then, I converted it to work with the Spring Framework and HttpInvoker. I worked great when I ran it as an application from Webshpere RAD. However, after I created a new .jnlp file to inlcude / download the TreeDemo.jar and all the Spring jars as resources it throws a NoClassDefFoundError :

java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext

As I understand it from the Oracle / Webstart documentation the resource jars listed in the jnlp file should automatically be downloaded and included in the class path. It finds the Treedemo.jar main class but not the ApplicationContext class from the Spring jar. The confusing part is that ApplicationContext class is in fact in the spring.jar. I can drill down through org/springframework/context/ApplicationContext and get to it in the webapp lib folder as well as import it into classes at compile time.

So, it appears that it is in the class path when run as a application from RAD, but when served via WebStart it does not get included in the class path or it is not reachable by Web Start.


<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://localhost:9080/SOSWeb/" href="TreeDemo.jnlp">
<vendor>IBM - JWS example of HelloWorld</vendor>
<description>Tree Demo - Example of JWS</description>
<description kind="short">Tree Demo with Spring DB Access example</description>
<j2se version="1.6+"/>
<jar href="spring.jar"/>
<jar href="TreeDemo.jar"/>
<jar href="spring-web.jar"/>
<jar href="spring-webmvc.jar"/>
<jar href="commons-logging.jar"/>
<jar href="commons-pool.jar"/>
<jar href="commons-lang.jar"/>
<jar href="commons-httpclient.jar"/>
<jar href="xmlconfig.jar"/>

<application-desc main-class=""/>

Any ideas ?
Thanks in advance.

Martin Vajsar

Joined: Aug 22, 2010
Posts: 3679

Welcome to the Ranch!

In my project, the files listed as resource are still listed in classpath in file. I'm not sure whether this is required, but I don't have problems running the app.
I agree. Here's the link:
subject: Spring Jar files - Can not find class def