Your problem is that you are stopping tomcat, which shuts down the jvm,
and then you are trying to start it again. Because the jvm has exited, it
never starts it again.
I'm not sure if this will work, but you could do a system exec that forks
into another process, and sleeps for a bit (long enough for tomcat to shut
down) before starting tomcat. once you've started that system.exec, then
shut tomcat down, and (I'm not sure if this will work) the forked process
will then start tomcat after its sleep...
just a thought.
cheesr
dim
On Tue, 24 Jul 2001, Hariharasubramanian Ranganathan wrote:
> 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]
>
>