On Fri, 20 Jul 2001, David Haraburda wrote:

> Have you tried using the Jdk12Interceptor?  That fixed class loading
> problems for me.  In your server.xml do:
> 
> <RequestInterceptor
> className="org.apache.tomcat.request.Jdk12Interceptor"/>

Got that, and it fixed the finding of my .conf files that I store in
WEB-INF/classes.  I can now read any text file I want from WEB-INF/classes
from a servlet.

> Note this will only fix the loading of CLASSES... if you have resources
> in your WEB-INF/classes directory, such as .properties files, that the
> ClassLoader is supposed to pick up, this will not happen.  I submitted a
> patch for this to the mailing list last night, but haven't heard
> anything from a developer/committer yet.

Odd.  Worked well for me.  As soon as the admin gets the box back up, I'll
drop you a copy of my server.xml and the code I use to read a text file.

> A good way to see what ClassLoader is being used is by sticking in a
> System.out.println( "CL: " +
> Thread.currentThread().getContextClassLoader().toString() );
> 
> If it says com.sun.misc.something (I forget the package name), you are
> using the System classloader... if it says AdaptiveClassLoader, you are
> using the Tomcat one which knows about stuff in the WEB-INF directory.


Nice tip - I'll try that!

Will

Reply via email to