tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher K.St.John <>
Subject Re: Writing my own valve to do extra logging
Date Sat, 09 Mar 2002 02:37:28 GMT
"Dr. Evil" wrote:
> So my solution is to write a valve ... Then I edited
> bin/ so that mylogger.jar was on the java
> classpath

 Don't edit bin/ to change the classpath
on the command line. Just put the jar in the right
place (as defined by the classloader howto, it looks
like you've done that), put back the way
it was before, and it should all work.

 You don't strictly have to know this, but here's the
deal: Catalina defines a bunch of classloaders. They
form a tree. The root of the tree is the built in
Java classloaders. The leaf classloaders can see the
classes loaded by the root, but the root can't see
the classes loaded by the leaves. One of the
built-in classloaders loads the stuff on the
classpath. Since you your Valve's jar is on the
classpath, a built-in classloader is loading your
Valve. So far so good. But your valve depends on a
Catalina class. And the Catalina class _isn't_
loaded by the built-in classloader, it's loaded by a
Catalina classloader. The built-in classloader can't
see the Catalina classes (they're not on the
classpath), so you get the error message. The
solution is to let a Catalina classloader load your
Valve's jar. Instead of having a classpath, the
classloader that loads the stuff in server/lib just
loads every jar in the directory. So just copy your
jar into the right directory and Catalina will see

Christopher St. John

To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message