tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: newbie:: classpath settings
Date Mon, 04 Dec 2000 19:10:36 GMT
"Ensing, Marco" wrote:

>  Hi all, I'm very pleased with tomcat 3.2. Running servlets and JSP works
> fine. Just a little questionI have a servlet callingtry{  Object myBean =
> Beans.instantiate(null, "my.package.MyClass");}The servlet is in the
> directory: /webapps/foo/WEB-INF/classesmy.package.MyClass is there as well.
> The null param is the classloader and should fall back on the system
> class-loader.I read somewhere that the /webapps/foo/WEB-INF/classes path is
> not the system class-loaderbut a specific tomcat-classpath. Should I put the
> /webapps/foo/WEB-INF/classes on the CLASSPATH environment variable ? Or is
> there a more appropriate way in the would people
> recommend to create a ClassLoader and use this object in the Beans.instantiate
> ? Any help is appreciated.Marco

What is the precise filename your bean class is loaded in?  It should be in
"/webapps/foo/WEB-INF/classes/my/package/MyClass.class in order to be loaded
correctly by the Beans.instantiate() method.

In general, you should *never* put WEB-INF/classes (or jar files in WEB-INF/lib)
on the classpath.  Tomcat builds a customized class loader that makes these
classes available to a web application automatically, and falls back to the
system class loader if you specify a class that is not found there.

Craig McClanahan

View raw message