On Tue, 16 Jul 2002, Andreas Probst wrote:

> Date: Tue, 16 Jul 2002 13:59:49 +0200
> From: Andreas Probst <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: RE: newbie - finding class files
>
>
> > On Mon, 15 Jul 2002, Andreas Probst wrote:
> >
> > >
> > > Hi all,
> > >
> > > does Tomcat really look into tomcatdir/server/lib? For me it seems
> > > Tomcat doesn't.
> > >
> >
> > This directory is only visible to the classloader for Tomcat itself, not
> > for webapps.  There is a special rule that makes servlet classes in
> > package "org.apache.catalina" available to webapps anyway, however, which
> > is why the standard WebdavServlet (as well as the other Tomcat features
> > that are available via servlets) can be loaded.
> >
> > Craig
>
> Thank you Craig.
>
> Could you please tell more about the rule or give a pointer. The
> class-loader-info of the Tomcat-Docu says nothing about the rule, but
> says, that "These classes and resources are TOTALLY invisible to web
> applications".
>

Actually, the rule is very simple, and it is there in the docs.  Look at
the picture of the class loader hierarchy in the Tomcat docs:

  http://jakarta.apache.org/tomcat/tomcat-4.0-doc/class-loader-howto.html

The classes that are visible to a web application are those in the class
loader for that webapp, and any of it's parent class loaders.  In other
words, an application can see the "WebappX" class loader for itself, plus
the "Shared", "Common", "System", and "Bootstrap" class loaders.  It can
*not* see the "Catalina" class loader.

Now, go down the page a few inches, and you'll see that the Catalina class
loader contains everything in server/classes and server/lib (including
"servlets-webdav.jar" that contains the WebDAV servlet).

> Bye.
>
> Andreas
>

Craig


> >
> >
> > > On the one hand the original webapp /webdav runs without errors. On
> > > the other hand, when I deploy a class that extends the original
> > > webdav-class org.apache.catalina.servlets.WebdavServlet (located in
> > > catalinahome\server\lib\servlets-webdav.jar) I get an
> > > java.lang.NoClassDefFoundError:
> > > org/apache/catalina/servlets/WebdavServlet.
> > >
> > > When I then copy catalinahome\server\lib\servlets-webdav.jar into
> > > catalinahome\webapps\mywebdav\WEB-INF\lib I get a different
> > > java.lang.NoClassDefFoundError:
> > > org/apache/catalina/servlets/DefaultServlet. DefaultServlet is
> > > located in catalinahome\server\lib\servlets-default.jar. So it seems
> > > Tomcat doesn't look into the catalinahome\server\lib\ directory. But
> > > why then runs the original /webdav app?
> > >
> > > What do I do wrong? Do I have to tell Tomcat somehow to look into the
> > > catalinahome\server\lib\ directory when running my webapp? Or do I
> > > have to copy all needed files from catalinahome\server\lib\ to my
> > > webapp's lib-directory? I suppose this shouldn't be the solution.
> > >
> > > By the way: I'm running Tomcat 4.0.4 on Windows 2000.
> > >
> > > Thanks a lot in advance.
> > >
> > > Andreas
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to