You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Shinta Tjio <st...@broadjump.com> on 2001/03/02 20:03:06 UTC

Tomcat's class loader

Hi, all,
I have a servlet, ServletFoo, that calls a utility
class that lives in a jar file under $TOMCAT_HOME/lib.
This utility class calls the ResourceBundle.getBundle() 
on a resource bundle that lives in the servlet's home 
(i.e: $TOMCAT_HOME/webapps/SomeContext/WEB-INF/).

What I found out was that ServletFoo was loaded by
Tomcat's AdaptiveClassLoader. The utility class
was loaded by the system's default class loader.
And of course, that utility class called 
ResourceBundle.getBundle() it couldn't find the
resouce file because it lived in the servlet's
home and the system's default class loader doesn't
have CLASSPATH pointing to that directory.

I have been able to fix this by passing the servlet's
class loader to the utility class, so that it passes
it to the ResourceBundle.getBundle().

My question is, is this the expected behavior of
Tomcat's class loader? Or is this a bug?

thanks,
shinta