posted 16 years ago
That's hard to say without knowing your OS. Under Unix/Linux, I could do it via a remote shell, given the right system services and permissions.
If you're looking to be able to cycle Tomcat via a web request, a reading of the source code would probably give you a way to shutdown via a servlet request. Restarting it again is usually much trickier.
I don't know specifically about docs on embedding Tomcat, but since that's so popular, I would expect there's probably something out there either on the jakarta website's docs or in the downloaded code or both. And that WOULD make it easier to cycle Tomcat, running it embedded.
[ April 17, 2002: Message edited by: Tim Holloway ]
If you're looking to be able to cycle Tomcat via a web request, a reading of the source code would probably give you a way to shutdown via a servlet request. Restarting it again is usually much trickier.
I don't know specifically about docs on embedding Tomcat, but since that's so popular, I would expect there's probably something out there either on the jakarta website's docs or in the downloaded code or both. And that WOULD make it easier to cycle Tomcat, running it embedded.
[ April 17, 2002: Message edited by: Tim Holloway ]
An IDE is no substitute for an Intelligent Developer.
Ariffin Ahmad
Ranch Hand
Posts: 84
posted 16 years ago
i'm running it on win 2000. but we do have a plan to make it be able to run on all platform. yeah, i think, i can shut it down from my servlet, and i guess through socket connection, because that what i can understand <tomcat_home>\bin\shutdown.bat do, but, to restart it, hm.. quite tricky.
i'm thinking that, embedded tomcat into my java application will resolve this problem....
any suggestion?.....
i'm thinking that, embedded tomcat into my java application will resolve this problem....
any suggestion?.....

posted 16 years ago
For portability, you'd pretty much either need to write a looping batch script to keep restarting it until some testable switch was turned off, or do the eqivalent with a Tomcat embedding. If Tomcat was
embedded in a Java app, of course, that would be more portable than a script - precious little overlap between Windows batchfiles and Unix shell scripts.
Without having done any actual research, I'd say that you might store an action-on-shutdown variable as a database item or something, post to the AJP connection from a (secured!) control servlet to cause shutdown, then in the calling app/script, loop back and restart Tomcat if the action-on-shutdown state indicated restart. Or you could forget about action-on-shutdown and unconditionally restart, and depend on the operator to forcibly process-terminate
embedded in a Java app, of course, that would be more portable than a script - precious little overlap between Windows batchfiles and Unix shell scripts.
Without having done any actual research, I'd say that you might store an action-on-shutdown variable as a database item or something, post to the AJP connection from a (secured!) control servlet to cause shutdown, then in the calling app/script, loop back and restart Tomcat if the action-on-shutdown state indicated restart. Or you could forget about action-on-shutdown and unconditionally restart, and depend on the operator to forcibly process-terminate

An IDE is no substitute for an Intelligent Developer.
Ariffin Ahmad
Ranch Hand
Posts: 84
posted 16 years ago
the reason i want to restart tomcat dynamically is, i made some changes to server.xml and tomcat-user.xml on <tomcat_home>\conf\ through my servlet, and i want tomcat to re read the configuration file. the only solution that come in my mind is to restart the tomcat.
hm.... any suggestion?.....
hm.... any suggestion?.....

