You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by steflik <st...@binghamton.edu> on 2009/12/09 15:31:19 UTC

Tomcat Config Question

I'm teaching a Web Programming course and am using Tomcat 6 for the
servlet/jsp portion of the course. I have created a context for each student
in the server.xml file and it seems to work pretty good but if a student
modifies the web.xml file in their application I have to restart the sever
before it takes effect. Is there a way to configure Tomcat so that changes
in a users web.xml file will be automatically sensed by the server and take
effect immediately?

Dick Steflik
Binghamton University
Binghamton, NY
-- 
View this message in context: http://old.nabble.com/Tomcat-Config-Question-tp26711131p26711131.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat Config Question

Posted by David Smith <dn...@cornell.edu>.
I'm assuming your docBase for this app is not inside tomcat's webapps
folder and in that case, you're right to wonder how tomcat finds the
context.xml file.  The <Context ... >...</Context> element can also be
in it's own file named after the path attribute - i.e. alti.xml in
conf/Catalina/localhost.  Replace 'Catalina' with your tomcat's Service
name from server.xml and 'localhost' with your Host name, again from
server.xml.  Tomcat looks there as well for the webapp's <Context
...></Context> element and you can remove the path attribute.

--David

steflik wrote:
> Chuck,
> I'm a little bit hesitant as a number of the students are still struggleing
> 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. This is an example of a <Context> ststement as they are
> currently in server.xml:
>
> <Context  docBase="/home/alti/public_html/alti" path="/alti" debug="0"
> reloadable="true" crossContext="true"></Context>
>
> 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.?  If this is where it
> goes what name does the file get context.xml or alti.xml?
>
> Dick Steflik
> Binghamton University
>
>
> Pid Ster wrote:
>   
>> On 15/12/2009 04:17, steflik wrote:
>>     
>>> Chuck,
>>>
>>> OK, I've read the document several times and still can't figure out what
>>> it
>>> is you are trying to tell me. I'm not using WARs so /META-INF/? doesn't
>>> come
>>> into play. If the<Context>  statements don't go in to server.xml where
>>> should I put them, context.xml doesn't seem to be the appropriate place?
>>>       
>> A web app in the form of a directory is just an exploded/uncompressed 
>> WAR.  Putting a META-INF directory inside the app dir still applies. 
>> Try it and see.
>>
>> (The manager & host-manager apps preinstalled in Tomcat also use a 
>> META-INF directory.)
>>
>>
>> p
>>
>>
>>     
>>> Dick Steflik
>>> Binghamton University
>>>
>>>
>>>
>>> Caldarale, Charles R wrote:
>>>       
>>>>> From: steflik [mailto:steflik@binghamton.edu]
>>>>> Subject: Re: Tomcat Config Question
>>>>>
>>>>> Do I just move the<context>  statements out of server.xml and into
>>>>> context.xml?
>>>>>           
>>>> It's<Context>  not<context>  - case matters.
>>>>
>>>>         
>>>>> or is there something else I have to do.
>>>>>           
>>>> Reading the doc would be a good first step:
>>>> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
>>>>
>>>>   - Chuck
>>>>
>>>>
>>>> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>>>> MATERIAL and is thus for use only by the intended recipient. If you
>>>> received this in error, please contact the sender and delete the e-mail
>>>> and its attachments from all computers.
>>>>
>>>>
>>>>
>>>>
>>>>         

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat Config Question

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dick,

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
index.jsp
my-great-example.jsp
easter-egg.jsp

$ jar cvf cschultz.war *.jsp

$ echo "Professor,

Please find attached my submission for assignment 1.1.

Thanks,
- -chris" | mutt -a cschultz.war steflik@binghamton.edu

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
conf/[service]/[host]/[appname].xml

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksnuyAACgkQ9CaO5/Lv0PDn+ACgju7+0lr9idqtcnJjhxP6hxzV
Py0AoLKFb8gCWXQvUT9uhcfhYr7cVxxh
=Uo7j
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat Config Question

Posted by Pid <pi...@pidster.com>.
On 15/12/2009 13:15, steflik wrote:
>
> Chuck,
> I'm a little bit hesitant as a number of the students are still struggleing
> 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. This is an example of a<Context>  ststement as they are
> currently in server.xml:
>
> <Context  docBase="/home/alti/public_html/alti" path="/alti" debug="0"
> reloadable="true" crossContext="true"></Context>
>
> 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.?  If this is where it
> goes what name does the file get context.xml or alti.xml?

Maybe this would be useful: look at "User Web Applications"

  http://tomcat.apache.org/tomcat-6.0-doc/config/host.html


p



> Dick Steflik
> Binghamton University
>
>
> Pid Ster wrote:
>>
>> On 15/12/2009 04:17, steflik wrote:
>>>
>>> Chuck,
>>>
>>> OK, I've read the document several times and still can't figure out what
>>> it
>>> is you are trying to tell me. I'm not using WARs so /META-INF/? doesn't
>>> come
>>> into play. If the<Context>   statements don't go in to server.xml where
>>> should I put them, context.xml doesn't seem to be the appropriate place?
>>
>> A web app in the form of a directory is just an exploded/uncompressed
>> WAR.  Putting a META-INF directory inside the app dir still applies.
>> Try it and see.
>>
>> (The manager&  host-manager apps preinstalled in Tomcat also use a
>> META-INF directory.)
>>
>>
>> p
>>
>>
>>> Dick Steflik
>>> Binghamton University
>>>
>>>
>>>
>>> Caldarale, Charles R wrote:
>>>>
>>>>> From: steflik [mailto:steflik@binghamton.edu]
>>>>> Subject: Re: Tomcat Config Question
>>>>>
>>>>> Do I just move the<context>   statements out of server.xml and into
>>>>> context.xml?
>>>>
>>>> It's<Context>   not<context>   - case matters.
>>>>
>>>>> or is there something else I have to do.
>>>>
>>>> Reading the doc would be a good first step:
>>>> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
>>>>
>>>>    - Chuck
>>>>
>>>>
>>>> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>>>> MATERIAL and is thus for use only by the intended recipient. If you
>>>> received this in error, please contact the sender and delete the e-mail
>>>> and its attachments from all computers.
>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat Config Question

Posted by steflik <st...@binghamton.edu>.
Chuck,
I'm a little bit hesitant as a number of the students are still struggleing
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. This is an example of a <Context> ststement as they are
currently in server.xml:

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

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.?  If this is where it
goes what name does the file get context.xml or alti.xml?

Dick Steflik
Binghamton University


Pid Ster wrote:
> 
> On 15/12/2009 04:17, steflik wrote:
>>
>> Chuck,
>>
>> OK, I've read the document several times and still can't figure out what
>> it
>> is you are trying to tell me. I'm not using WARs so /META-INF/? doesn't
>> come
>> into play. If the<Context>  statements don't go in to server.xml where
>> should I put them, context.xml doesn't seem to be the appropriate place?
> 
> A web app in the form of a directory is just an exploded/uncompressed 
> WAR.  Putting a META-INF directory inside the app dir still applies. 
> Try it and see.
> 
> (The manager & host-manager apps preinstalled in Tomcat also use a 
> META-INF directory.)
> 
> 
> p
> 
> 
>> Dick Steflik
>> Binghamton University
>>
>>
>>
>> Caldarale, Charles R wrote:
>>>
>>>> From: steflik [mailto:steflik@binghamton.edu]
>>>> Subject: Re: Tomcat Config Question
>>>>
>>>> Do I just move the<context>  statements out of server.xml and into
>>>> context.xml?
>>>
>>> It's<Context>  not<context>  - case matters.
>>>
>>>> or is there something else I have to do.
>>>
>>> Reading the doc would be a good first step:
>>> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
>>>
>>>   - Chuck
>>>
>>>
>>> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>>> MATERIAL and is thus for use only by the intended recipient. If you
>>> received this in error, please contact the sender and delete the e-mail
>>> and its attachments from all computers.
>>>
>>>
>>>
>>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Tomcat-Config-Question-tp26711131p26794592.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat Config Question

Posted by Pid <pi...@pidster.com>.
On 15/12/2009 04:17, steflik wrote:
>
> Chuck,
>
> OK, I've read the document several times and still can't figure out what it
> is you are trying to tell me. I'm not using WARs so /META-INF/? doesn't come
> into play. If the<Context>  statements don't go in to server.xml where
> should I put them, context.xml doesn't seem to be the appropriate place?

A web app in the form of a directory is just an exploded/uncompressed 
WAR.  Putting a META-INF directory inside the app dir still applies. 
Try it and see.

(The manager & host-manager apps preinstalled in Tomcat also use a 
META-INF directory.)


p


> Dick Steflik
> Binghamton University
>
>
>
> Caldarale, Charles R wrote:
>>
>>> From: steflik [mailto:steflik@binghamton.edu]
>>> Subject: Re: Tomcat Config Question
>>>
>>> Do I just move the<context>  statements out of server.xml and into
>>> context.xml?
>>
>> It's<Context>  not<context>  - case matters.
>>
>>> or is there something else I have to do.
>>
>> Reading the doc would be a good first step:
>> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
>>
>>   - Chuck
>>
>>
>> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>> MATERIAL and is thus for use only by the intended recipient. If you
>> received this in error, please contact the sender and delete the e-mail
>> and its attachments from all computers.
>>
>>
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Tomcat Config Question

Posted by steflik <st...@binghamton.edu>.
Chuck,

OK, I've read the document several times and still can't figure out what it
is you are trying to tell me. I'm not using WARs so /META-INF/? doesn't come
into play. If the <Context> statements don't go in to server.xml where
should I put them, context.xml doesn't seem to be the appropriate place?

Dick Steflik
Binghamton University

 

Caldarale, Charles R wrote:
> 
>> From: steflik [mailto:steflik@binghamton.edu]
>> Subject: Re: Tomcat Config Question
>> 
>> Do I just move the <context> statements out of server.xml and into
>> context.xml?
> 
> It's <Context> not <context> - case matters.
> 
>> or is there something else I have to do.
> 
> Reading the doc would be a good first step:
> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Tomcat-Config-Question-tp26711131p26789182.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Tomcat Config Question

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: steflik [mailto:steflik@binghamton.edu]
> Subject: Re: Tomcat Config Question
> 
> Do I just move the <context> statements out of server.xml and into
> context.xml?

It's <Context> not <context> - case matters.

> or is there something else I have to do.

Reading the doc would be a good first step:
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.



Re: Tomcat Config Question

Posted by Pid <pi...@pidster.com>.
On 14/12/2009 18:46, steflik wrote:
>
> Markus,
> Do I just move the<context>  statements out of server.xml and into
> context.xml?
> or is there something else I have to do. If thats all I have to do do I
> place them before or after the watched element tag that is already in the
> context.xml file?

There should be multiple context.xml, one for each webapp, in it's 
META-INF folder.

The global conf/context.xml should contain only general settings you 
wish to apply to all webapps.


p


> Dick Steflik
>
>
>
> Markus Schönhaber-10 wrote:
>>
>> 09.12.2009 15:31, steflik:
>>
>>> I'm teaching a Web Programming course and am using Tomcat 6 for the
>>> servlet/jsp portion of the course. I have created a context for each
>>> student
>>> in the server.xml file and it seems to work pretty good but if a student
>>> modifies the web.xml file in their application I have to restart the
>>> sever
>>> before it takes effect. Is there a way to configure Tomcat so that
>>> changes
>>> in a users web.xml file will be automatically sensed by the server and
>>> take
>>> effect immediately?
>>
>> Adding<Context>s to server.xml is strongly discouraged nowadays. Among
>> the reasons for this discouragement is exactly the problem you're facing
>> now.
>> See
>> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
>>
>> --
>> Regards
>>    mks
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat Config Question

Posted by steflik <st...@binghamton.edu>.
Markus,
Do I just move the <context> statements out of server.xml and into
context.xml?
or is there something else I have to do. If thats all I have to do do I
place them before or after the watched element tag that is already in the
context.xml file?

Dick Steflik



Markus Schönhaber-10 wrote:
> 
> 09.12.2009 15:31, steflik:
> 
>> I'm teaching a Web Programming course and am using Tomcat 6 for the
>> servlet/jsp portion of the course. I have created a context for each
>> student
>> in the server.xml file and it seems to work pretty good but if a student
>> modifies the web.xml file in their application I have to restart the
>> sever
>> before it takes effect. Is there a way to configure Tomcat so that
>> changes
>> in a users web.xml file will be automatically sensed by the server and
>> take
>> effect immediately?
> 
> Adding <Context>s to server.xml is strongly discouraged nowadays. Among
> the reasons for this discouragement is exactly the problem you're facing
> now.
> See
> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
> 
> -- 
> Regards
>   mks
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Tomcat-Config-Question-tp26711131p26779949.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat Config Question

Posted by Markus Schönhaber <to...@list-post.mks-mail.de>.
09.12.2009 15:31, steflik:

> I'm teaching a Web Programming course and am using Tomcat 6 for the
> servlet/jsp portion of the course. I have created a context for each student
> in the server.xml file and it seems to work pretty good but if a student
> modifies the web.xml file in their application I have to restart the sever
> before it takes effect. Is there a way to configure Tomcat so that changes
> in a users web.xml file will be automatically sensed by the server and take
> effect immediately?

Adding <Context>s to server.xml is strongly discouraged nowadays. Among
the reasons for this discouragement is exactly the problem you're facing
now.
See
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

-- 
Regards
  mks

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat Config Question

Posted by Pid <pi...@pidster.com>.
On 09/12/2009 14:52, Neil Aggarwal wrote:
>> The global conf/context.xml file should have a
>> <WatchedResource>  element for WEB-INF/web.xml; Tomcat should
>> automatically restart the webapp unless you've removed that
>> or disabled deployOnStartup in the<Host>  element.
>
> In my experience, Tomcat has problems reloading webapps
> on occasion.  This may work 80% of the time, but you
> are still going to have to restart Tomcat fairly often.

Maybe that's a side effect of your app's architecture.


p


> 	Neil
>
> --
> Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net
> Host your tomcat app on a CentOS VPS for only $25/month!
> Unmetered bandwidth, 7 day free trial, Google Checkout
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Tomcat Config Question

Posted by Neil Aggarwal <ne...@JAMMConsulting.com>.
> The global conf/context.xml file should have a 
> <WatchedResource> element for WEB-INF/web.xml; Tomcat should 
> automatically restart the webapp unless you've removed that 
> or disabled deployOnStartup in the <Host> element.

In my experience, Tomcat has problems reloading webapps
on occasion.  This may work 80% of the time, but you
are still going to have to restart Tomcat fairly often.

	Neil

--
Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net
Host your tomcat app on a CentOS VPS for only $25/month!
Unmetered bandwidth, 7 day free trial, Google Checkout


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Tomcat Config Question

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: steflik [mailto:steflik@binghamton.edu]
> Subject: Tomcat Config Question
> 
> I have created a context for each student in the server.xml file 

Don't do that - very strongly discouraged to have any webapp-specific information in server.xml.  The <Context> elements should be in conf/Catalina/[host]/[appName].xml, since you likely don't want them in each webapp's META-INF/context.xml file.

> but if a student modifies the web.xml file in their application 
> I have to restart the sever before it takes effect.

The global conf/context.xml file should have a <WatchedResource> element for WEB-INF/web.xml; Tomcat should automatically restart the webapp unless you've removed that or disabled deployOnStartup in the <Host> element.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat Config Question

Posted by Peter Crowther <pe...@melandra.com>.
2009/12/9 steflik <st...@binghamton.edu>

>
> I'm teaching a Web Programming course and am using Tomcat 6 for the
> servlet/jsp portion of the course. I have created a context for each
> student
> in the server.xml file and it seems to work pretty good but if a student
> modifies the web.xml file in their application I have to restart the sever
> before it takes effect. Is there a way to configure Tomcat so that changes
> in a users web.xml file will be automatically sensed by the server and take
> effect immediately?
>
> Dick, I think others have commented on creating separate context files and
adding watched resources.  I'll just add the point that if I know student
code, it's going to be buggy.  This could be a bigger problem than in many
web development environments.  All the webapps in a servlet container run in
the same JVM, and they're not defended from each other.  If someone runs the
JVM out of heap, it's gone for everyone; if a request runs forever, that
thread's locked until the server restarts; if someone puts if
(errorCondition) { System.out.println("Oops, I can't carry on from here");
System.exit(1); } then the server will suddenly stop.  Yes, you can fix the
last one of these with a security manager, but there really isn't any way of
defending against buggy student code.

If you're comfortable that you can survive under those circumstances, go for
it!

- Peter