tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Tomcat Config Question
Date Tue, 15 Dec 2009 16:36:48 GMT
Hash: SHA1


On 12/15/2009 8:15 AM, steflik wrote:
> I'm a little bit hesitant as a number of the students are still struggling
> to get their JSP project done. Right now the server is running and the
> <Context> statements that define where the apps are are right at the end of
> server.xml.

My recommendations:

1. Have your students submit a WAR file that you install under the
auto-deploy "webapps". You can call it 'cschultz.war' for me, for
example. The students (and you) can access it via http://host/cschultz/

2. No META-INF/context.xml is required if there's nothing "special" to
add. I see you have:

> <Context  docBase="/home/alti/public_html/alti" path="/alti" debug="0"
> reloadable="true" crossContext="true"></Context>

If the <Context> is in META-INF/context.xml, then the docBase and path
attributes are forbidden. "debug" is meaningless (you must be looking at
old documentation if you've read anything about a "debug" attribute),
relodable="true" is the default, and crossContext="true" is probably
unnecessary (feel free to convince me).

This constitutes a <Context> with nothing "special". As such, the webapp
/does not need to have a META-INF/context.xml file/.

So, let's say I'm you and I want to configure my server to support this.
Here's what I do:

1. Remove all <Context> elements from Tomcat's conf/server.xml file.
2. Make sure that there is a <Host> with autoDeploy="true" and
appBase=somewhere ("webapps" is not a bad choice).
3. When a student submits a webapp WAR file (see below), drop it into
the webapps directory and it will auto-deploy.

If you are a student, you do this:

$ ls

$ jar cvf cschultz.war *.jsp

$ echo "Professor,

Please find attached my submission for assignment 1.1.

- -chris" | mutt -a cschultz.war

Now, to answer your other questions:

> If this is moved out of server.xml and into
> /home/alti/public_html/alti/META_INF/  how will Tomcat know where the alti
> app is; I always thought that Tomcat followed the paths it found in
> server.xml to figure out where all of the apps were.?

Yes, but you can also use auto-deploy. The auto-deployer looks for
changes in the webapps directory (new directories or WAR files) and
deploys them. Any previously-deployed webapp is checked for changes
(.class or .jar file changes) and re-deployed if necessary.

Another option is to put the file into Tomcat's configuration directory
instead of within the WAR file (or exploded webapp deployment
directory). In that case, you put the file into

That file will have a docBase that points either to a WAR file or an
exploded WAR structure on the disk. The name of the .xml file dictates
the deployment path, so the "path" attribute is forbidden.

If you need to have the students copy their own WAR files (or exploded
WAR structures) somewhere specific, you could set up a webapps directory
that allowed them to do that using standard UNIX file permissions
(though you might have to sacrifice some security, or set up something
overly complicated to make it work).

Another option would be to set up a <Host> for each student, with it's
own auto-deploy webapps directory to which only that student has access.
Then they are responsible for their own WAR deployment.

Hope that helps,
- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message