You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Ensing, Marco" <Ma...@ca.com> on 2000/12/04 19:50:46 UTC

newbie:: classpath settings

Hi all,
 
I'm very pleased with tomcat 3.2. Running servlets and JSP works fine. Just a little question
 
I have a servlet calling
try{
  Object myBean = Beans.instantiate(null, "my.package.MyClass");
}
The servlet is in the directory: /webapps/foo/WEB-INF/classes
my.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-loader
but 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 workers.properties.
 
Or would people recommend to create a ClassLoader and use this object in the Beans.instantiate ? 
 
Any help is appreciated.
 
Marco
 

Re: newbie:: classpath settings

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
"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 workers.properties.Or 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