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
one way along those lines is to write a perl script that first stops the service and then starts it again and then just invoke that from java. however that may lead to problems if the service fails to come back up. there are various admin features that a provided with the latest tomcat version under /manager and /admin you might be able to look at the source of these and find a better way.
Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
posted 16 years ago
Thank you Tim, I am still trying to find a way within java. Thanks.
Why do you want to restart Tomcat? It used to be necessary after serious changes to the code but the management interface is much improved. If you really have to - note that you will have to do much more than exec the shutdown bat - you will have to read the output of that process until it is finished, then exec the startup. Bill
posted 16 years ago
Thank you William A very good suggestion. Best Regards, Pourang Emami
Except that admin app is hosted within the JVM you're trying to restart.
There does not exist any internals that allows a running instance of Tomcat to be entirely reloaded within that same JVM. This changes (so I've heard) in Tomcat 5.x, which uses a jakarta commons daemon project. There was a discussion about Tomcat being more 'self healing' and restarting itself when it goes down. The response from one of the Tomcat commiters was that this would "be in Tomcat 5".
One can assume then, that it will be possible to force tomcat to reload at *any* time, not just when it goes down.
And I'm moving this from Servlets -> Apache/Tomcat [ October 08, 2003: Message edited by: Mike Curwen ]
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.