You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by William Jaynes <wj...@mediaone.net> on 2001/01/10 16:33:07 UTC
[OT] restarting individual apps in Tomcat
This question is a bit off topic for this group but I imagine it is of interest
to alot of us.
If I have multiple web apps running under tomcat, is it possible to update and
restart one of them without restarting all of tomcat? Is it necessary to disrupt
all the apps in order to update just one of them?
Will
Re: [OT] restarting individual apps in Tomcat
Posted by William Jaynes <wj...@mediaone.net>.
> Yes it is possible to have individual apps reload, without restarting the
entire
> Tomcat JVM. You have to mark your apps in the server.xml file as reloadable:
>
> <Context path="/myapp" docBase="..." reloadable="true">
>
> for this to work. In addition, the classes themselves have to be in
WEB-INF/classes
> for this to work -- not on the system classpath.
>
> NOTE: Tomcat 3.2 is sometimes inconsistent about catching changes to
non-Servlet
> classes (which, in a Struts app, means almost everything since the only
servlet is
> the controller). Tomcat 4.0 has a much better algorithm for doing this.
>
> As an extra added bonus, both versions of Tomcat also attempt to save and
restore
> your session information across the application restart. If your session
attributes
> are Serializable, they will be restorted when the app is reloaded.
Thank you. I'm chagrined that I didn't catch this in the docs.
So I tried this. Getting into the middle of my struts 1.0 app on tomcat 3.2, and
then changing a log statement and recompiling one of my classes. The next button
I pressed in the browser caused a ClassCastException as shown below. The last
message from the struts logging info is
Looking for ActionForm bean under attribute 'malpPhysicianSelectionForm'
This is unexpected and puzzling. If the session info wasn't saved I would expect
a null pointer at worst, and at best the ActionServlet would simply recreate the
bean. But I don't know what gives with a ClassCastException. Is some class
loader getting confused?
java.lang.ClassCastException: edu.umich.umms.newmalp.MalpPhysicianSelectionForm
at
org.apache.struts.action.ActionServlet.processActionForm(ActionServlet.java:1397
)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1319)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:447)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConne
ctionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)
Re: [OT] restarting individual apps in Tomcat
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
William Jaynes wrote:
> This question is a bit off topic for this group but I imagine it is of interest
> to alot of us.
>
And, since my "day job" is developing Tomcat, you might think I would know the
answer, too? :-)
>
> If I have multiple web apps running under tomcat, is it possible to update and
> restart one of them without restarting all of tomcat? Is it necessary to disrupt
> all the apps in order to update just one of them?
>
Yes it is possible to have individual apps reload, without restarting the entire
Tomcat JVM. You have to mark your apps in the server.xml file as reloadable:
<Context path="/myapp" docBase="..." reloadable="true">
for this to work. In addition, the classes themselves have to be in WEB-INF/classes
for this to work -- not on the system classpath.
NOTE: Tomcat 3.2 is sometimes inconsistent about catching changes to non-Servlet
classes (which, in a Struts app, means almost everything since the only servlet is
the controller). Tomcat 4.0 has a much better algorithm for doing this.
As an extra added bonus, both versions of Tomcat also attempt to save and restore
your session information across the application restart. If your session attributes
are Serializable, they will be restorted when the app is reloaded.
>
> Will
Craig McClanahan