Jacob's answer is not strictly true:  the order is only partially inverted.
The actual order is:
WEB-INF/classes
WEB-INF/lib/*.jar
System Loader (including $CATALINA_HOME/common/endorsed/*.jar)
$CATALINA_HOME/common/classes
$CATALINA_HOME/common/lib/*.jar
$CATALINA_HOME/shared/classes
$CATALINA_HOME/shared/lib/*.jar


"Shapira, Yoav" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hi,
Jacob's answer is right, but I don't know if it's a complete answer to
your question.

>So, I'm curious as whether there is a determinate order that the files
in
>WEB-INF/lib are placed on the classpath, and also whether lib is placed
>before WEB-INF/classes. (i.e. is it alphabetical or simply whatever
order
>it shows up in an unsorted directory listing)

Like Jacob said, the unpacked WEB-INF/classes will be loaded and looked
for before the jars in WEB-INF/lib.  Within /WEB-INF/lib, however, you
cannot make assumptions jar loading order.

SRV 9.4 says
"The web application classloader must load classes from the WEB-INF/
classes
directory first, and then from library JARs in the WEB-INF/lib
directory."

So the order of the jars is not specified.  Looking at the tomcat code,
it comes down to the Catalina DirContext implementation of
javax.naming.Context's
public NamingEnumeration listBindings(Name name)
                               throws NamingException
and the contract for that method doesn't mention a specific ordering.

Looking at the localhost log for tomcat on my Solaris box, it seems to
be unix alphabetical, e.g. A.jar B.jar C.jar a.jar b.jar c.jar looks at
the log on my local Solaris box.

So in conclusion, unless I missed something, you shouldn't rely on the
class loading order of jars within the WEB-INF/lib directory.  Ideally,
you should ensure you only have one version of class on your path, or
that they are in separate repositories (e.g. WEB-INF/lib version
common/lib) where the loading order preference is clearly defined.

Yoav Shapira
Millennium ChemInformatics





--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to