views:

48

answers:

1

I'm currently working on a gwt app where the server uses a few third party libs. Recently I discovered that one of these libs isn't being properly loaded when running my app in deployed mode, and I just can't seem to figure out what I'm doing wrong.

In my build script I have the following classpath declaration:

  <path id="project.class.path">
     <pathelement location="${war.dir}/WEB-INF/classes"/>
     <fileset dir="${war.dir}/WEB-INF/lib" includes="**/*.jar"/>
  </path>

and in a later target I copy the jar I need to the right location:

<copy todir="${war.dir}/WEB-INF/lib" file="someJar.jar" />

The project builds as it should, without any errors. The jars are copied to where the should be, and are included in the resulting war file. In development mode everything is working as it should, everything gets loaded properly and I hear no complaints. However, in the deployed version I get this thrown at me:

java.lang.NoClassDefFoundError: 
org/apache/commons/lang/exception/NestableRuntimeException
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:621)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)

org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2331)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:976)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1451)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
my.package.server.util.SomeUtils.doSomethingFantastic(SomeUtils.java:84)

Line 84 in SomeUtils is trying to instantiate a class from someJar.jar.

I know very little about how the class loader for gwt works, and I sure could use a hand. Anyone got any ideas on how to solve this?

+1  A: 

From the stacktrace, looks like commons-lang is not on your classpath, and whatever code is at SomeUtils.java line 84 is somehow invoking something that needs to load a class in the commons-lang JAR.

If commons-lang is not already on the classpath (in WEB-INF/lib) then it sounds like it should be.

matt b