> From: "Shrotriya, Sumit" <[EMAIL PROTECTED]>
> Sent: Wednesday, January 29, 2003 1:06 PM
> Subject: RE: Web App Classloader..How?


> Hi Haytham,
>   I dont think Tomcat will allow you to load classes from any directory
> below the
> %TOMCAT% home dir. If it does then it would be a great security
concern..by
> changing
> the classpath env variable it is the java classloader that is loading the
> files for
> you and not the apache classloaders..
>   Yoav, I think the WAR files need to be installed in the webapps folder
in
> order
> for tomcat to install them..

Nope. uh uh. Tomcat can give a rip about where it gets its classes from.

Here's what's going on, as far as I can tell.

The problem seems to be that you're deploying your webapp structure on drive
D:, and you see it loading stuff from C:.

The issue is basically specification of the WORK directory that Tomcat uses
to do things.

For example, in a generic deployment of the stock binaries, the work
directory defaults to $CATALINA_HOME/work.

So, if I drop in an everyday normal testWebApp.war file into the
$CATALINA_HOME/webapp, Tomcat does two, distinct, things.

One, the autodeploy mechanism of Tomcat explodes the WAR file in the webapp
directory, and creates a Context based on that directory. In this case, it
create $CATALINE_HOME/webapp/testWebApp.

Two, any JSPs in that webapp will create .java and .class files in
$CATALINA_HOME/work/Standalone/localhost/testWebApp/...

Now, if you create your OWN context, such as:

<Context path="/test" docBase="D:/testWebApp">
</Context>

Then, your webapp is already exploded (as you're specifying simply a
directory), but the WORK directory (for JSPs et al) is still in
$CATALINA_HOME/work, which in this example is still on drive C:.

So, the JSP classes will be loaded from drive C, but your webapp classes are
loaded from drive D:.

Now, if your context is this instead:

<Context path="/test" docBase="D:/testWebApp.WAR">
</Context>

Note that this is a WAR file rather than a directory. Tomcat, by default,
will explode the relevant bits of the WAR file on deploy. This is subtly
different from what happens when a WAR is dropped in the directory
$CATALINA_HOME/webapp, as in that case Tomcat creates a context as well. In
this example, where does it explode it too? It explodes the WAR into the
WORK directory. So, even though the webapp is on drive D, the classes are
expanded onto drive C and loaded from there.

If you turn off the WAR exploding option, then they should stay on drive D,
however, the JSPs will still go over and generate java and class file in the
WORK directory on C:.

So.

Simply put, if you want to keep stuff off of your C drive, you need to
reconfigure the HOST and change its WORK directory to point someplace more
appropriate.

Reference the entry on the Host element in the Tomcat docs.

Regards,

Will Hartung
([EMAIL PROTECTED])




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

Reply via email to