tags:

views:

56

answers:

2
+1  Q: 

Tomcat CLASSPATH

I have a very annoying problem:

My project (JSP, Servlet) requires Xerces-J 2.8.1 or higher. But on our server (Tomcat 5.5) xerces 2.6.2 always comes up first and that results in a severe error.

I checked $CLASSPATH and did some clean-ups. However, xerces 2.6.2 is still there. Could anyone tell me how to know where this xerces 2.6.2 is?

+1  A: 

If you're including the Xerces jar in your web app then it depends on how classloading is configured for your application and/or server. There's information about that here:

http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html

brindy
+1  A: 

First of all, the environment variable $CLASSPATH (and its Windows equivalent %CLASSPATH%) is ignored by anything else than the Java runtime command (java.exe in Windows) which is been executed without any of the -cp, -classpath and -jar arguments. Don't confuse this term as being the real classpath. That environment variable is just intented as (poor) convenience for starters who doesn't want to type the whole -cp or -classpath argument everytime.

As to your actual problem, Tomcat internally also uses Xerces to parse XML files as outlined in this document. If you have full control over the server, then best what you can do is to place the newer Xerces JAR file in the /common/endorsed folder, as explained in the document.

BalusC