You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by ko...@ubs.com on 2003/09/12 00:12:49 UTC

Tomcat classloader behaviour and Xerces

Hi,

I'm trying to understand why regardless of whether or not a particular version of Xerces is present in a webapp's WEB-INF/lib, the version in Tomcat's common/lib is always picked up. With other simple classes sharing the same namespace that I have used to test this, the version in the webapp is correctly picked up.

I suspect that this is something to do with the fact that Xerces usage internally by Tomcat which loads it in the parent classloader, but I would appreciate someone providing me with the full logical explanation.

On a related note, if the behaviour is such that webapps are tied into the version of Xerces in common/endorsed, that's not such a problem because this location is configurable. However, other classes such as JDBC drivers are documented as being supposed to reside in common/lib, which would present a problem when having a standard build supporting many different applications with different dependencies. However, a solution to this seems to be to rely on the placing of such libraries in the endorsed directory, which can be configured.

This appears to work, but I would just like to check whether there is anything wrong with this approach. If common/lib must be used, then that would effectively mean that applications team would have to create "fake" builds of Tomcat using symlinks so that they could place the versions of dependencies that they required in common/lib. 

All answers much appreciated.

Thanks,

Kosh


Visit our website at http://www.ubs.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.


Re: Tomcat classloader behaviour and Xerces

Posted by Bill Barker <wb...@wilshire.com>.
AFAIK, there shouldn't be a Xerces in common/lib.

That having been said, Xerces is handled specially in Tomcat 4.x.  If there
is a copy in common/lib or shared/lib, then it will use that one in
preference to WEB-INF/lib.  Of course, it always checks the System
ClassLoader first, so it will usually grab the one in common/endorsed.


<ko...@ubs.com> wrote in message
news:AAF1ED447D54FA49B7C0970EEDBEDF910182CCE0@NLDNC004PEX1.ubsgs.ubsgroup.net...
Hi,

I'm trying to understand why regardless of whether or not a particular
version of Xerces is present in a webapp's WEB-INF/lib, the version in
Tomcat's common/lib is always picked up. With other simple classes sharing
the same namespace that I have used to test this, the version in the webapp
is correctly picked up.

I suspect that this is something to do with the fact that Xerces usage
internally by Tomcat which loads it in the parent classloader, but I would
appreciate someone providing me with the full logical explanation.

On a related note, if the behaviour is such that webapps are tied into the
version of Xerces in common/endorsed, that's not such a problem because this
location is configurable. However, other classes such as JDBC drivers are
documented as being supposed to reside in common/lib, which would present a
problem when having a standard build supporting many different applications
with different dependencies. However, a solution to this seems to be to rely
on the placing of such libraries in the endorsed directory, which can be
configured.

This appears to work, but I would just like to check whether there is
anything wrong with this approach. If common/lib must be used, then that
would effectively mean that applications team would have to create "fake"
builds of Tomcat using symlinks so that they could place the versions of
dependencies that they required in common/lib.

All answers much appreciated.

Thanks,

Kosh


Visit our website at http://www.ubs.com

This message contains confidential information and is intended only
for the individual named.  If you are not the named addressee you
should not disseminate, distribute or copy this e-mail.  Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses.  The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission.  If
verification is required please request a hard-copy version.  This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.