tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: Class loader looks in Tomcat work directory and not in webapp directory for resources
Date Wed, 18 Aug 2004 12:57:50 GMT


>That just seems to be where Tomcat5 deploys JARs from WAR files...
>probably for easy access.

The reasons are more complex and with more history than that.  There is
a long-standing issue (of sorts -- it's not an issue to some people,
like me, but others complain persistently ;)) with URLClassLoader
locking JARs.  One way to avoid locking is to copy the original JAR into
a place that's owned by Tomcat, and then lock the copy so users can
still modify the original and reload their webapp (at which time another
copy operation will be done and so on).

This will be modified and improved in Tomcat 5.1 (or 5.5, whatever we
decide to call it).

So the bottom line is the same as always: stick to the Servlet
Specification as tightly as you can, and in this case the Java spec
itself regarding resource-loading from JARS in a context-sensitive
ClassLoader (admittedly an abstruse area of the JLS), and you will save
yourself long-term pain.

And thanks to the original poster for also posting his solution.  As you
said, this will make future archive searches better.

Yoav Shapira

This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message