Discussion:
Reload webapp and context
Roland Carlsson
2005-03-17 07:32:54 UTC
Permalink
Hi!

I have a problem with an webapp with deploying webapps. The problem is the
contextfile that since my development environment differs a little to my
deployment environment have to be edited a little after deployment. But how
do I force tomcat to re-load the context? Right now the only way I know
about is to reboot tomcat witch leads to a full stop of all my web-apps
instead of only one witch in turn leads to more complaints from my users.

So, is there a way to force reload of the context when reloading the
web-app?

Thanks in advance
Roland Carlsson
Lionel Farbos
2005-03-17 10:02:57 UTC
Permalink
Hi,

To reload, start, stop, deploy, undeploy contexts see the Manager :
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/manager-howto.html

I don't know your tomcat version, but it works since TC 4.

Cheers.

On Thu, 17 Mar 2005 08:32:54 +0100
Post by Roland Carlsson
Hi!
I have a problem with an webapp with deploying webapps. The problem is the
contextfile that since my development environment differs a little to my
deployment environment have to be edited a little after deployment. But how
do I force tomcat to re-load the context? Right now the only way I know
about is to reboot tomcat witch leads to a full stop of all my web-apps
instead of only one witch in turn leads to more complaints from my users.
So, is there a way to force reload of the context when reloading the
web-app?
Thanks in advance
Roland Carlsson
---------------------------------------------------------------------
Bernard
2005-03-17 19:20:46 UTC
Permalink
Hi,

Maybe this can help:

In Tomcat 5.5, the file context.xml in the server's conf directory
allows for watched resources, which when touched, cause an application
reload:

It looks like this:

<!-- The contents of this file will be loaded for each web application
-->
<Context>

<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>META-INF/context.xml</WatchedResource>

<!-- Uncomment this to disable session persistence across Tomcat
restarts -->
<!--
<Manager pathname="" />
-->

</Context>

I am trying to not include the manager application in a production
system because of the additional security risk.

Regards,
Bernard
Post by Lionel Farbos
Hi,
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/manager-howto.html
I don't know your tomcat version, but it works since TC 4.
Cheers.
On Thu, 17 Mar 2005 08:32:54 +0100
Post by Roland Carlsson
Hi!
I have a problem with an webapp with deploying webapps. The problem is the
contextfile that since my development environment differs a little to my
deployment environment have to be edited a little after deployment. But how
do I force tomcat to re-load the context? Right now the only way I know
about is to reboot tomcat witch leads to a full stop of all my web-apps
instead of only one witch in turn leads to more complaints from my users.
So, is there a way to force reload of the context when reloading the
web-app?
Thanks in advance
Roland Carlsson
---------------------------------------------------------------------
---------------------------------------------------------------------
Bernard
2005-03-17 20:52:52 UTC
Permalink
Roland,

You might want to add yourself to the cc list of this bug:

Normal startup causes server error 500
http://issues.apache.org/bugzilla/show_bug.cgi?id=34050

It might be in the area of your interest.

Regards,

Bernard
Post by Lionel Farbos
Hi,
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/manager-howto.html
I don't know your tomcat version, but it works since TC 4.
Cheers.
On Thu, 17 Mar 2005 08:32:54 +0100
Post by Roland Carlsson
Hi!
I have a problem with an webapp with deploying webapps. The problem is the
contextfile that since my development environment differs a little to my
deployment environment have to be edited a little after deployment. But how
do I force tomcat to re-load the context? Right now the only way I know
about is to reboot tomcat witch leads to a full stop of all my web-apps
instead of only one witch in turn leads to more complaints from my users.
So, is there a way to force reload of the context when reloading the
web-app?
Thanks in advance
Roland Carlsson
---------------------------------------------------------------------
---------------------------------------------------------------------
Torrey Rice
2005-03-18 02:50:40 UTC
Permalink
I have a similar problem in 5.5 when deploying my .war files. If I go to
the manager and undeploy a webapp that was deployed from a war it only
deletes the .war file and not the exploded directory. If I want to
deploy an update I have to stop tomcat and start it again for it to
pickup the change in the war file. Even when I have auto-deploy set to
true.

I have done everything I can think of but it seems that to make an
update like this in Tomcat you have to stop and restart which is really
unfortunate.
Post by Bernard
Roland,
Normal startup causes server error 500
http://issues.apache.org/bugzilla/show_bug.cgi?id=34050
It might be in the area of your interest.
Regards,
Bernard
Post by Lionel Farbos
Hi,
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/manager-howto.html
I don't know your tomcat version, but it works since TC 4.
Cheers.
On Thu, 17 Mar 2005 08:32:54 +0100
Post by Roland Carlsson
Hi!
I have a problem with an webapp with deploying webapps. The problem is the
contextfile that since my development environment differs a little to my
deployment environment have to be edited a little after deployment. But how
do I force tomcat to re-load the context? Right now the only way I know
about is to reboot tomcat witch leads to a full stop of all my web-apps
instead of only one witch in turn leads to more complaints from my users.
So, is there a way to force reload of the context when reloading the
web-app?
Thanks in advance
Roland Carlsson
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
Bernard
2005-03-18 04:06:33 UTC
Permalink
Hi Torrey,

I can't comment on .war file deployment directly because I am not
using it. But I want to help you anyway, suggesting the approach I
would take.

I would forget manager for a moment. A basic servlet engine (these
things have been around for 10 years or more, remember Sun's Java
Server) are capable to reload servlets if any of the watched resources
change.

Server restart for your purpose is a very sad state of affairs, not
acceptable by today's standards.

So I would try to touch any of the watched resources, e.g. a servlet
class file, a servlet jar file or the web.xml file.

That, from my experience with old mod_jserv, does not immediately
trigger class re-loading. Only the next servlet request provides the
event for that (noticable delay of servlet response).

If that does not work, then you have the most basic problem. If it
works, then you have a feeling for how it should work. Then work your
way up to war file deplayment with manager.
I would think that you don't need manager for most management tasks
e.g. war file deployment because who can assume that you want to
introduce a security risk by providing such powerful access to your
application via http???

Playing around a little is sometimes very useful.

Regards,

Bernard
Post by Torrey Rice
I have a similar problem in 5.5 when deploying my .war files. If I go to
the manager and undeploy a webapp that was deployed from a war it only
deletes the .war file and not the exploded directory. If I want to
deploy an update I have to stop tomcat and start it again for it to
pickup the change in the war file. Even when I have auto-deploy set to
true.
I have done everything I can think of but it seems that to make an
update like this in Tomcat you have to stop and restart which is really
unfortunate.
Post by Bernard
Roland,
Normal startup causes server error 500
http://issues.apache.org/bugzilla/show_bug.cgi?id=34050
It might be in the area of your interest.
Regards,
Bernard
Post by Lionel Farbos
Hi,
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/manager-howto.html
I don't know your tomcat version, but it works since TC 4.
Cheers.
On Thu, 17 Mar 2005 08:32:54 +0100
Post by Roland Carlsson
Hi!
I have a problem with an webapp with deploying webapps. The problem is the
contextfile that since my development environment differs a little to my
deployment environment have to be edited a little after deployment. But how
do I force tomcat to re-load the context? Right now the only way I know
about is to reboot tomcat witch leads to a full stop of all my web-apps
instead of only one witch in turn leads to more complaints from my users.
So, is there a way to force reload of the context when reloading the
web-app?
Thanks in advance
Roland Carlsson
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
Torrey Rice
2005-03-18 06:48:06 UTC
Permalink
This post might be inappropriate. Click to display it.
Bernard
2005-03-18 07:27:34 UTC
Permalink
Hi,

I want to deploy a servlet jar file without using the manager
application.

From reading context.xml, I understand that is possible to re-start an
application by modifying the files that are listed in it e.g.

<WatchedResource>WEB-INF/web.xml</WatchedResource>

But it doesn't work for me. How can I get it to work?
Has anybody seen this working at all?

With the jserv servlet engine, I only had to touch any file in the
list of the servlet repositories and the servlet zone was re-started.

My requirements are minimal, fully satisfied by the old jserv.


Many thanks,

Bernard

QM
2005-03-17 12:58:46 UTC
Permalink
On Thu, Mar 17, 2005 at 08:32:54AM +0100, Roland Carlsson wrote:
: do I force tomcat to re-load the context? Right now the only way I know
: about is to reboot tomcat witch leads to a full stop of all my web-apps
: instead of only one witch in turn leads to more complaints from my users.

Perhaps a non-technical solution would help:

1/ schedule regular deployment times. Apps expect downtime during these
windows, and you're free to start/stop at will.

2/ Put each app in its own JVM. Such isolation solves several
headaches, not the least of which is the ability for each app to choose
its own downtime window.

-QM
--
software -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com
Roland Carlsson
2005-03-17 13:12:06 UTC
Permalink
Hi and thanks for your answer!

Do I read you correctly that there are no solution but to restart Tomcat to
reload the context completly?

Lionel, the manager doesn't seem to re-read the context file under
/conf/Catalina/mydomain/myapp.xml and that is the one I have have to change.

Thanks in advance
Roland Carlsson
Post by QM
: do I force tomcat to re-load the context? Right now the only way I know
: about is to reboot tomcat witch leads to a full stop of all my web-apps
: instead of only one witch in turn leads to more complaints from my users.
1/ schedule regular deployment times. Apps expect downtime during these
windows, and you're free to start/stop at will.
2/ Put each app in its own JVM. Such isolation solves several
headaches, not the least of which is the ability for each app to choose
its own downtime window.
-QM
QM
2005-03-17 13:24:07 UTC
Permalink
On Thu, Mar 17, 2005 at 02:12:06PM +0100, Roland Carlsson wrote:
: Do I read you correctly that there are no solution but to restart Tomcat to
: reload the context completly?

That's not at all what I said. I can't provide an authoritative answer
to that question as I didn't write Tomcat. ;)

With that in mind, context isoliation and scheduled maintenance/downtime
windows are fairly standard practices in the J2EE realm. While they
don't directly address your concern of completely reloading a context,
they tangentially address your desire to start and stop Tomcat whenever
you please.

-QM
--
software -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com
Lionel Farbos
2005-03-17 14:12:27 UTC
Permalink
On Thu, 17 Mar 2005 14:12:06 +0100
Post by Roland Carlsson
Hi and thanks for your answer!
Do I read you correctly that there are no solution but to restart Tomcat to
reload the context completly?
False.
Post by Roland Carlsson
Lionel, the manager doesn't seem to re-read the context file under
/conf/Catalina/mydomain/myapp.xml and that is the one I have have to change.
If you try a reload, or stop then start, effectively no change :-(
but if you try undeploy then deploy : it works :-))

so, it is possible without restarting entirely tomcat
Post by Roland Carlsson
Thanks in advance
Roland Carlsson
Post by QM
: do I force tomcat to re-load the context? Right now the only way I know
: about is to reboot tomcat witch leads to a full stop of all my web-apps
: instead of only one witch in turn leads to more complaints from my users.
1/ schedule regular deployment times. Apps expect downtime during these
windows, and you're free to start/stop at will.
2/ Put each app in its own JVM. Such isolation solves several
headaches, not the least of which is the ability for each app to choose
its own downtime window.
-QM
---------------------------------------------------------------------
Loading...