Bookmark Topic Watch Topic
  • New Topic

Reload Servlet-container from the code?

 
Pourang Emami
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Report post to moderator
container:either tomcat or oc4j
technology: servlet
OS: winxp pro
How I can Reload tomcat from the code?
I wanted to use Runtime.exec("Tomcat/bin/shutdown") and thenstartup.
But it is so obvious after shutting down there is no possibility to run the second line of code.
Possible sollutions:
1-A restart exe file in the container?
2-Any technique to do this with java?
Thank you for your help.
Best Regards,
Pourang Emami
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
It's a bit of a crazy request, but sure, you could probably write a stop-start batch file and run it from the initial Tomcat instance.
I'm reasonably sure it'll be OK, but you need to check that Runtime.exec() retains the OS shell after the parent process dies, otherwise the batch file will die and your restart will still fail.
Just promise me you'll protect this code from the outside world. Just imagine what would happen if it was embedded in a web page and someone used it malicioously
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13073
6
  • Mark post as helpful
  • send pies
  • Report post to moderator
See my response in the Servlets forum - Ya know, its really annoying when people post the same request in multiple forums.
Bill
(Moose bites can be very painful!)
[ October 05, 2003: Message edited by: William Brogden ]
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Report post to moderator
Closing this. Please refer here for replies.
 
    Bookmark Topic Watch Topic
  • New Topic