Setting Up the Tomcat CLASSPATH

Next, you need to set the CLASSPATH for Jakarta Tomcat. Specifically, you must include the following JAR files and directories:

  • soap.jar

  • xerces.jar

  • mail.jar

  • activation.jar

  • Directory for your SOAP application class files

To set the Tomcat CLASSPATH, edit the server startup file (on Windows, this file is tomcat.bat; on Unix, it is tomcat.sh). For example, I added the following lines to the section entitled “Set Up the Runtime Classpath” in my tomcat.bat file:

echo Adding xerces.jar to beginning of CLASSPATH
set CP=c:\web_services\lib\xerces.jar;%CP%
echo Adding soap.jar to CLASSPATH
set CP=%CP%;C:\web_services\lib\soap.jar
echo Adding mail.jar and activation.jar to CLASSPATH
set CP=%CP%;c:\web_services\lib\mail.jar;c:\web_services\lib\activation.jar
echo Adding SOAP Examples Directory
set CP=%CP%;c:\web_services\examples\classes

Note that the Tomcat distribution includes its own XML parser, but the built-in parser is not namespace-aware and therefore will not work with Apache SOAP. Hence, you need to force Tomcat to use Xerces (1.1.2 or higher) by prepending xerces.jar to the very beginning of your CLASSPATH. For example:

set CP=c:\web_services\lib\xerces.jar;%CP%

Get Web Services Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.