Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

restart tomcat from remote  RSS feed

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can i stop or restart tomcat from remote site?...
is there anywhere i can go for a tutorial, about embedde tomcat into my java application?...
thanks....
 
Bartender
Posts: 19976
95
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ariffin Ahmad
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?.....
 
Tim Holloway
Bartender
Posts: 19976
95
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ariffin Ahmad
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?.....
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
embedding tomcat:
http://www.onjava.com/pub/a/onjava/2002/04/03/tomcat.html
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!