Will-

I just got your explanation and I really appreciate you taking the time.
Just to clarify, my goal is not to keep things off of the C drive.  If
Tomcat needs to do work on the C drive, that is fine.  My main goal is to
make my application work (jsp's compile and find the classes they need under
my web application deployment in the D drive) without me having to touch
anything on the Tomcat installation (well, at least not often) or on the C
drive for that matter.

So, I tried the option you've shown with the deployment of the war file like
this:

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

This worked as you described below and the JSP's compiled and worked fine.
I am happy.  Now when I update my war, will Tomcat redeply my application
without a restart?  If I have to restart, will Tomcat just overwrite all the
old files it had under the default work directory?  Is there a better way to
do this without having to change more than is normally needed (context in
server.xml and web.xml configuration) in Tomcat?  Are there any negatives to
this way of deploy?

I know I will be updating the application and redeploying a new war several
times from now until a little after we go into production.  So I am
exploring the best way to make the update process work like I described and
still have the application able to run properly.

Mostly, I am interested in the downsides of deploying a war under the D
drive and letting Tomcat deal with exploding it in the work directory.  This
seems like the cleanest way to do it.  Very much like just dropping the war
in webapps, with the addition of having to create a Context entry in
server.xml.  This is actually great if there are no downsides or limitations
to what we can do with the application (accessing other resources available
from a standard webapps install).

Again, thanks for taking the time and this has been really helpful.

Haytham


-----Original Message-----
From: Will Hartung [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 4:27 PM
To: Tomcat Users List
Subject: Re: Web App Classloader..How?


> 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]



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

Reply via email to