tags:

views:

339

answers:

1

JBOSS is throwing a:

java.lang.NoSuchMethodError: org.w3c.dom.Document.getDocumentURI()Ljava/lang/String;

Error when loading a wsdl. Can I configure it to prefer the library in my WAR instead of the system or app server lib?

+1  A: 

The app server should already be using any JARs in WEB-INF/lib, along with the system and app server library paths - the standard approach to this is that the ClassLoader for WEB-INF/lib delegates class loading to the app server lib, which delegates class loading to the server lib, and only if the parent classloader cannot find the class does it attempt to load it's own classes.

In other words, if you place the same class in WEB-INF/lib and the app server's lib, the latter JAR will always be used. This means it is possible to create conflicts by having classes with the same names but different versions available in both WEB-INF/lib and the app server's lib - are you sure this isn't what's causing your issues? Can you resolve the conflict?

Some app servers (not sure about JBoss, but I know WebSphere allows it) lets you configure the classloader so that the child loader is checked first (child-first vs parent-first), but this type of configuration can cause other issues.

matt b
I eventually resolved the issue by downgrading my spring-ws libraries to 1.0.4 which work with the JBOSS 4.0.2 server.I did do a lot of classloader research on JBOSS: http://jboss.org/community/docs/DOC-9288 which helped understand and solve the problem.
jon077