You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Hariharasubramanian Ranganathan <ha...@kumaran.com> on 2001/07/24 06:56:18 UTC

Restarting TOMCAT

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: harir@kumaran.com


Re: Using Tomcat with MSAccess

Posted by Bojan Smojver <bo...@binarix.com>.
Maybe you can increase the number of lines in your DOS window to catch
the error message (if there is one).

Have you tried to execute the same SQL through some other tool that uses
JDBC/ODBC bridge? How about just a little Java app with main() that just
does the SQL bit? I'd verify if that SQL stuff works without Tomcat and
then move on...

Bojan

Jeffrey Worst wrote:
> 
> I can't see any errors in the Tomcat DOS window so I'm assuming they have
> scrolled off the screen.  The only error I see is the HTML generated by the
> "else" clause if the insertIntoDB method doesn't run successfully.  I'm
> running Win98 and the Access DB file access properties are only set to
> Archive.
> 
> Jeff
> 
> ----- Original Message -----
> From: "Bojan Smojver" <bo...@binarix.com>
> To: <to...@jakarta.apache.org>
> Sent: Friday, August 03, 2001 10:23 PM
> Subject: Re: Using Tomcat with MSAccess
> 
> > What's the actual error message?
> >
> > Maybe you can print out the SQL statement to see if the syntax is OK. It
> > could be invalid SQL. Are you running this under Windows NT/2000 or
> > 9x/ME? Maybe the user Tomcat runs under doesn't have access rights on
> > this database?
> >
> > I don't really use Access, I'm just trying to apply my PostgreSQL
> > experiences...
> >
> > And maybe you can have a look at JBoss or similar EJB container. No more
> > SQL...
> >
> > Bojan
> >
> > Jeffrey Worst wrote:
> > >
> > > I'm writing an applet using Tomcat to register new members for a
> library.
> > > Everything works fine until I get to the part where the new information
> is
> > > being inserted into the MSAccess DB.  I have commented below where the
> error
> > > occurs.  Any help would be appreciated.
> > >
> > > Thanks,
> > >
> > > Jeff
> >

Re: Using Tomcat with MSAccess

Posted by Jeffrey Worst <je...@erols.com>.
I can't see any errors in the Tomcat DOS window so I'm assuming they have
scrolled off the screen.  The only error I see is the HTML generated by the
"else" clause if the insertIntoDB method doesn't run successfully.  I'm
running Win98 and the Access DB file access properties are only set to
Archive.

Jeff


----- Original Message -----
From: "Bojan Smojver" <bo...@binarix.com>
To: <to...@jakarta.apache.org>
Sent: Friday, August 03, 2001 10:23 PM
Subject: Re: Using Tomcat with MSAccess


> What's the actual error message?
>
> Maybe you can print out the SQL statement to see if the syntax is OK. It
> could be invalid SQL. Are you running this under Windows NT/2000 or
> 9x/ME? Maybe the user Tomcat runs under doesn't have access rights on
> this database?
>
> I don't really use Access, I'm just trying to apply my PostgreSQL
> experiences...
>
> And maybe you can have a look at JBoss or similar EJB container. No more
> SQL...
>
> Bojan
>
> Jeffrey Worst wrote:
> >
> > I'm writing an applet using Tomcat to register new members for a
library.
> > Everything works fine until I get to the part where the new information
is
> > being inserted into the MSAccess DB.  I have commented below where the
error
> > occurs.  Any help would be appreciated.
> >
> > Thanks,
> >
> > Jeff
>


Re: Using Tomcat with MSAccess

Posted by Bojan Smojver <bo...@binarix.com>.
What's the actual error message?

Maybe you can print out the SQL statement to see if the syntax is OK. It
could be invalid SQL. Are you running this under Windows NT/2000 or
9x/ME? Maybe the user Tomcat runs under doesn't have access rights on
this database?

I don't really use Access, I'm just trying to apply my PostgreSQL
experiences...

And maybe you can have a look at JBoss or similar EJB container. No more
SQL...

Bojan

Jeffrey Worst wrote:
> 
> I'm writing an applet using Tomcat to register new members for a library.
> Everything works fine until I get to the part where the new information is
> being inserted into the MSAccess DB.  I have commented below where the error
> occurs.  Any help would be appreciated.
> 
> Thanks,
> 
> Jeff

Re: Using Tomcat with MSAccess

Posted by John Baker <jb...@teamenergy.com>.
On Thursday 09 August 2001 06:08 am, you wrote:
> For what's happening now, you need to print out the SQL, make sure it's
> syntactically correct, and print out the exception message that's returned.
> Don't know if it's just me, but I find that I tend to make really dumb SQL
> errors For later, you should ask yourself what will happen when "Patrick
> O'Reilly" tries to register?
>
> Also, when you're doing string comparisons, you should get into the habit
> of using
> 	"".equals(passwd)
> rather than
> 	passwd.equals( "" )
>
> It looks a little strange, but will behave correctly if passwd happens to
> be null (if for instance your page was called from an HTML file that  did
> not include the passwd field in the form).

No you shouldn't. That's totally evil. For a start, you're creating another 
String object by doing "", and to add to this, you're saying it's ok to pass 
null to equals. Passing null to the equals method is an awful idea. You 
actually want:

if ((passwd != null) && (passwd.lenght() == 0)) {
   // Then do something
}

That's far nicer, and doesn't put across the impression you don't know what 
you're talking about :-)

> Cheers,
>
> Greg Trasuk, President
> StratusCom Manufacturing Systems Inc. - We use information technology to
> solve business problems on your plant floor.

[ badly, by the looks of it :p ]

> http://stratuscom.ca
>
> > -----Original Message-----
> > From: Jeffrey Worst [mailto:jeffworst@erols.com]
> > Sent: Friday, August 03, 2001 10:09 PM
> > To: tomcat-user@jakarta.apache.org
> > Subject: Using Tomcat with MSAccess
> >
> >
> > I'm writing an applet using Tomcat to register new members
> > for a library.
> > Everything works fine until I get to the part where the new
> > information is
> > being inserted into the MSAccess DB.  I have commented below
> > where the error
> > occurs.  Any help would be appreciated.
> >
> > Thanks,
> >
> > Jeff
> > ------------------
> > //New member registration
> >
> > import java.io.*;
> > import javax.servlet.*;
> > import javax.servlet.http.*;
> > import java.util.*;
> > import java.sql.*;
> >
> > public class NewMember extends HttpServlet {
> >    private Statement statement = null;
> >    private Connection connection = null;
> >    String url = "jdbc:odbc:NewMember";
> >    String username="";
> >    String password="";
> >
> >    public void init( ServletConfig config )
> >       throws ServletException
> >    {
> >       super.init( config );
> >
> >       try {
> >          Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
> >          connection =
> >             DriverManager.getConnection( url, username, password );
> >       }
> >       catch ( Exception e ) {
> >          e.printStackTrace();
> >          connection = null;
> >       }
> >    }
> >
> >    public void doPost( HttpServletRequest req,
> >                        HttpServletResponse res )
> >       throws ServletException, IOException
> >    {
> >       String passwd, member_type, fname, mname, lname, address1,
> >           address2, city, zip, country, home_phone, work_phone, email,
> > member_since, remarks;
> >
> >       passwd= req.getParameter( "passwd" );
> >       member_type = req.getParameter( "member_type" );
> >       fname = req.getParameter( "fname" );
> >       mname = req.getParameter( "mname" );
> >       lname = req.getParameter( "lname" );
> >       address1 = req.getParameter( "address1" );
> >       address2 = req.getParameter( "address2" );
> >       city = req.getParameter( "city" );
> >       zip = req.getParameter( "zip" );
> >    country = req.getParameter( "country" );
> >       home_phone = req.getParameter( "home_phone" );
> >       work_phone = req.getParameter( "work_phone" );
> >       email = req.getParameter( "email" );
> >       member_since = req.getParameter( "member_since" );
> >       remarks = req.getParameter( "remarks" );
> >
> >       PrintWriter output = res.getWriter();
> >       res.setContentType( "text/html" );
> >
> >       if ( passwd.equals( "" ) ||
> >            fname.equals( "" ) ||
> >            lname.equals( "" ) ) {
> >          output.println( "<H3> Please click the back " +
> >                          "button and fill in all " +
> >                          "fields.</H3>" );
> >          output.close();
> >          return;
> >       }
> >
> >    //Below is where the problem occurs.  I get the HTML
> > message below of "An
> > error occured..."
> >    //I think the insertIntoDB method is not working.  It's
> > being inserted
> > into a MSAccess DB
> >    //which has been registered.
> >
> >       boolean success = insertIntoDB("'" + passwd + "','" +
> > member_type +
> > "','" + fname + "','" +
> >       mname + "','" + lname + "','" + address1 + "','" +
> > address2 + "','" +
> > city + "','" + zip + "','" +
> >       country + "','" + home_phone + "','" + work_phone +
> > "','" + email +
> > "','" + member_since +
> >        "','" + remarks + "'" );
> >
> >       if ( success )
> >          output.print( "<H2>Thank you " + fname +
> >                        " for registering.</H2>" );
> >       else
> >          output.print( "<H2>An error occurred. " +
> >                        "Please try again later.</H2>" );
> >
> >       output.close();
> >    }
> >
> >    private boolean insertIntoDB( String stringtoinsert )
> >    {
> >       try {
> >          statement = connection.createStatement();
> >          statement.execute(
> >             "INSERT INTO NewMember values (" +
> >             stringtoinsert + ");" );
> >          statement.close();
> >       }
> >       catch ( Exception e ) {
> >          System.err.println(
> >             "ERROR: Problems with adding new entry" );
> >          e.printStackTrace();
> >          return false;
> >       }
> >
> >       return true;
> >    }
> >
> >    public void destroy()
> >    {
> >       try {
> >          connection.close();
> >       }
> >       catch( Exception e ) {
> >          System.err.println( "Problem closing the database" );
> >       }
> >    }
> > }

-- 
John Baker, BSc CS.
Java developer, Linux lover.
I don't wanna rock, DJ.

RE: Using Tomcat with MSAccess

Posted by Greg Trasuk <st...@on.aibn.com>.
For what's happening now, you need to print out the SQL, make sure it's
syntactically correct, and print out the exception message that's returned.
Don't know if it's just me, but I find that I tend to make really dumb SQL
errors For later, you should ask yourself what will happen when "Patrick
O'Reilly" tries to register?

Also, when you're doing string comparisons, you should get into the habit of
using
	"".equals(passwd)
rather than
	passwd.equals( "" )

It looks a little strange, but will behave correctly if passwd happens to be
null (if for instance your page was called from an HTML file that  did not
include the passwd field in the form).

Cheers,

Greg Trasuk, President
StratusCom Manufacturing Systems Inc. - We use information technology to
solve business problems on your plant floor.
http://stratuscom.ca

> -----Original Message-----
> From: Jeffrey Worst [mailto:jeffworst@erols.com]
> Sent: Friday, August 03, 2001 10:09 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Using Tomcat with MSAccess
>
>
> I'm writing an applet using Tomcat to register new members
> for a library.
> Everything works fine until I get to the part where the new
> information is
> being inserted into the MSAccess DB.  I have commented below
> where the error
> occurs.  Any help would be appreciated.
>
> Thanks,
>
> Jeff
> ------------------
> //New member registration
>
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.util.*;
> import java.sql.*;
>
> public class NewMember extends HttpServlet {
>    private Statement statement = null;
>    private Connection connection = null;
>    String url = "jdbc:odbc:NewMember";
>    String username="";
>    String password="";
>
>    public void init( ServletConfig config )
>       throws ServletException
>    {
>       super.init( config );
>
>       try {
>          Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
>          connection =
>             DriverManager.getConnection( url, username, password );
>       }
>       catch ( Exception e ) {
>          e.printStackTrace();
>          connection = null;
>       }
>    }
>
>    public void doPost( HttpServletRequest req,
>                        HttpServletResponse res )
>       throws ServletException, IOException
>    {
>       String passwd, member_type, fname, mname, lname, address1,
>           address2, city, zip, country, home_phone, work_phone, email,
> member_since, remarks;
>
>       passwd= req.getParameter( "passwd" );
>       member_type = req.getParameter( "member_type" );
>       fname = req.getParameter( "fname" );
>       mname = req.getParameter( "mname" );
>       lname = req.getParameter( "lname" );
>       address1 = req.getParameter( "address1" );
>       address2 = req.getParameter( "address2" );
>       city = req.getParameter( "city" );
>       zip = req.getParameter( "zip" );
>    country = req.getParameter( "country" );
>       home_phone = req.getParameter( "home_phone" );
>       work_phone = req.getParameter( "work_phone" );
>       email = req.getParameter( "email" );
>       member_since = req.getParameter( "member_since" );
>       remarks = req.getParameter( "remarks" );
>
>       PrintWriter output = res.getWriter();
>       res.setContentType( "text/html" );
>
>       if ( passwd.equals( "" ) ||
>            fname.equals( "" ) ||
>            lname.equals( "" ) ) {
>          output.println( "<H3> Please click the back " +
>                          "button and fill in all " +
>                          "fields.</H3>" );
>          output.close();
>          return;
>       }
>
>    //Below is where the problem occurs.  I get the HTML
> message below of "An
> error occured..."
>    //I think the insertIntoDB method is not working.  It's
> being inserted
> into a MSAccess DB
>    //which has been registered.
>
>       boolean success = insertIntoDB("'" + passwd + "','" +
> member_type +
> "','" + fname + "','" +
>       mname + "','" + lname + "','" + address1 + "','" +
> address2 + "','" +
> city + "','" + zip + "','" +
>       country + "','" + home_phone + "','" + work_phone +
> "','" + email +
> "','" + member_since +
>        "','" + remarks + "'" );
>
>       if ( success )
>          output.print( "<H2>Thank you " + fname +
>                        " for registering.</H2>" );
>       else
>          output.print( "<H2>An error occurred. " +
>                        "Please try again later.</H2>" );
>
>       output.close();
>    }
>
>    private boolean insertIntoDB( String stringtoinsert )
>    {
>       try {
>          statement = connection.createStatement();
>          statement.execute(
>             "INSERT INTO NewMember values (" +
>             stringtoinsert + ");" );
>          statement.close();
>       }
>       catch ( Exception e ) {
>          System.err.println(
>             "ERROR: Problems with adding new entry" );
>          e.printStackTrace();
>          return false;
>       }
>
>       return true;
>    }
>
>    public void destroy()
>    {
>       try {
>          connection.close();
>       }
>       catch( Exception e ) {
>          System.err.println( "Problem closing the database" );
>       }
>    }
> }
>


Using Tomcat with MSAccess

Posted by Jeffrey Worst <je...@erols.com>.
I'm writing an applet using Tomcat to register new members for a library.
Everything works fine until I get to the part where the new information is
being inserted into the MSAccess DB.  I have commented below where the error
occurs.  Any help would be appreciated.

Thanks,

Jeff
------------------
//New member registration

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.sql.*;

public class NewMember extends HttpServlet {
   private Statement statement = null;
   private Connection connection = null;
   String url = "jdbc:odbc:NewMember";
   String username="";
   String password="";

   public void init( ServletConfig config )
      throws ServletException
   {
      super.init( config );

      try {
         Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
         connection =
            DriverManager.getConnection( url, username, password );
      }
      catch ( Exception e ) {
         e.printStackTrace();
         connection = null;
      }
   }

   public void doPost( HttpServletRequest req,
                       HttpServletResponse res )
      throws ServletException, IOException
   {
      String passwd, member_type, fname, mname, lname, address1,
          address2, city, zip, country, home_phone, work_phone, email,
member_since, remarks;

      passwd= req.getParameter( "passwd" );
      member_type = req.getParameter( "member_type" );
      fname = req.getParameter( "fname" );
      mname = req.getParameter( "mname" );
      lname = req.getParameter( "lname" );
      address1 = req.getParameter( "address1" );
      address2 = req.getParameter( "address2" );
      city = req.getParameter( "city" );
      zip = req.getParameter( "zip" );
   country = req.getParameter( "country" );
      home_phone = req.getParameter( "home_phone" );
      work_phone = req.getParameter( "work_phone" );
      email = req.getParameter( "email" );
      member_since = req.getParameter( "member_since" );
      remarks = req.getParameter( "remarks" );

      PrintWriter output = res.getWriter();
      res.setContentType( "text/html" );

      if ( passwd.equals( "" ) ||
           fname.equals( "" ) ||
           lname.equals( "" ) ) {
         output.println( "<H3> Please click the back " +
                         "button and fill in all " +
                         "fields.</H3>" );
         output.close();
         return;
      }

   //Below is where the problem occurs.  I get the HTML message below of "An
error occured..."
   //I think the insertIntoDB method is not working.  It's being inserted
into a MSAccess DB
   //which has been registered.

      boolean success = insertIntoDB("'" + passwd + "','" + member_type +
"','" + fname + "','" +
      mname + "','" + lname + "','" + address1 + "','" + address2 + "','" +
city + "','" + zip + "','" +
      country + "','" + home_phone + "','" + work_phone + "','" + email +
"','" + member_since +
       "','" + remarks + "'" );

      if ( success )
         output.print( "<H2>Thank you " + fname +
                       " for registering.</H2>" );
      else
         output.print( "<H2>An error occurred. " +
                       "Please try again later.</H2>" );

      output.close();
   }

   private boolean insertIntoDB( String stringtoinsert )
   {
      try {
         statement = connection.createStatement();
         statement.execute(
            "INSERT INTO NewMember values (" +
            stringtoinsert + ");" );
         statement.close();
      }
      catch ( Exception e ) {
         System.err.println(
            "ERROR: Problems with adding new entry" );
         e.printStackTrace();
         return false;
      }

      return true;
   }

   public void destroy()
   {
      try {
         connection.close();
      }
      catch( Exception e ) {
         System.err.println( "Problem closing the database" );
      }
   }
}


Re: Restarting TOMCAT

Posted by Hariharasubramanian Ranganathan <ha...@kumaran.com>.
----- Original Message -----
From: "Dmitri Colebatch" <di...@bigpond.net.au>
To: <to...@jakarta.apache.org>
Sent: Tuesday, July 24, 2001 10:49 AM
Subject: Re: Restarting TOMCAT


> 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...

I tried to fork a process and am stopping tomcat first, waiting for few
seconds and starting again.  But once tomcat shuts down, the process also
killed!   I can't guess the reason.


> just a thought.
>
> cheesr
> dim
Thanks,

Hari.


> 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: harir@kumaran.com
> >
> >
>


Re: Restarting TOMCAT

Posted by Dmitri Colebatch <di...@bigpond.net.au>.
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: harir@kumaran.com
> 
>