Hi All,
I'm using currently using T3.2.3 under Windows 2000 / Linux boxes. Since I
deployed the webserver on a remote machine, I tried to do some management
tasks through browser itself. So I write some servlets / JSPs to show the
list of files, download files and upload files.
Let say I disabled the auto-reload feature and I have to update my context
to a newer version. What I'll do is just upload the .WAR file to
...../webapps folder and I'll restart Tomcat *remotely*. This is my plan.
I succeed in all other cases except restarting Tomcat.
First I tried a batch file (tcrestart.bat) which stops (tomcat stop) and
starts (tomcat start) the tomcat. I'll run this command using
Runtime.exec() and Process. But when tomcat shuts down, it won't start
again. I can't guess why?
Second I tried to run the same through a seperate thread. i.e. I'll start a
thread which inturn do the same in first point. This time too, I failed.
Finally I go through the tomcat source code and found the easier way to stop
and start tomcat. Now I write the code as
import java.util.*;
import org.apache.tomcat.startup.Tomcat;
public class TomcatRestart implements Runnable {
public TomcatRestart() {
Thread t = new Thread( this);
t.start();
}
public void run() {
// Stop Tomcat
//
String[] stopargs = new String[1];
stopargs[0] = "-stop";
Tomcat.main( stopargs); // ---> Here tomcat
stops.
// Start Tomcat
//
String startargs = new String[] {};
Tomcat.main( startargs); // ---> here, it's
not starting.
}
}
I don't know where I'm making mistakes?
Please help me in this case or give me some suggestions, how to implement
this feature.
Thanks,
Hariharasubramanian.R
Developer, iEvents,
Kumaran Systems (Betawave Solutions)
www.kumaran.com
www.betawavesolutions.com
Reinforcing Your Business
Ph: 0091-44-620 2079, 4967 (Extn: 318/328)
E-Mail: [EMAIL PROTECTED]