Link to home
Start Free TrialLog in
Avatar of bhomass
bhomass

asked on

add to tomcat classpath

I am setting up a tomcat project for remote debugging by eclipse. I am able to set up the docbase using a <projectname>.xml ok. however, this project references a lib which I am debugging at the same time, and sits in another directory entirely.

when using eclipse wtp, it is able to somehow have tomcat access both the project and lib code. but when using tomcat directly, I don't know how to get tomcat to find code other than what is under WEB-INF/classes.

can someone explain how to add such a classpath?
Avatar of Jim Cakalic
Jim Cakalic
Flag of United States of America image

The information on this page may be of help to you (not sure which version of Tomcat you're running):
http://tomcat.apache.org/tomcat-5.0-doc/class-loader-howto.html

There are a number of classloaders involved in loading an application server and deployed web applications. The intent is to have control over which classes are shared and by whom. Of the 6 classloaders involved in running Tomcat, only the System classloader uses the classpath. However, the Tomcat startup scripts ignore the classpath environment variable so you can't just the variable, you have to change the startup scripts. Read the document. It is important to understand the classloading structure of your application server.

Tomcat 5.0 and 5.5 use the same classloading hierarchy. Tomcat 6.0's is slightly simpler.

Regards,
Jim Cakalic
Avatar of bhomass
bhomass

ASKER

I am not able to figure out how eclipse managed to load the dependent project classpath from your instructions and reading the tomcat doc. my version is 5.5, btw.

according to the doc, webappx is the classloader, I want to use for the dependent jar. there is no instruction on how to add a jar to this class loader, if it is not in the WEB-INF/classes or WEB-INF/lib. but, clealry, that is what eclipse wtp managed to do.

you mentioned changing the startup script, which would be catalina.bat. but nothing is the doc tells me how to modify it so that the additional jar gets picked up by webappx class loader.

what is missing here?
ASKER CERTIFIED SOLUTION
Avatar of Jim Cakalic
Jim Cakalic
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial