You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Ushakov, Sergey N" <us...@int.com.ru> on 2001/10/30 09:04:44 UTC

launching Tomcat from Java

Hello,

I am writing a java app that is intended as sort of control center. It
should also occasionally start and stop Tomcat.

Unfortunately I still cannot find a better solution for this than
Runtime.exec("...startup...", ...).

My attempts to use Bootstrap.main() also give a good result ;)  But only
until I wish to stop Tomcat. Then Bootstrap.main ("stop") just kills the
whole JVM... :(

Still avoiding Runtime.exec() would be great. Any ideas? Any ways to
parameterize Catalina/Bootstrap/etc ?

Regards,
Sergey Ushakov




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: launching Tomcat from Java

Posted by "Ushakov, Sergey N" <us...@int.com.ru>.
Thank you Craig, that is something I wanted to hear :)

By the way, I did not dare removing System.exit() myself as I found half a
dozen classes that use this call... Perhaps some of these calls deserve
changing to something else...

Regards,
Sergey


----- Original Message -----
From: "Craig R. McClanahan" <cr...@apache.org>
To: "Tomcat Users List" <to...@jakarta.apache.org>; "Ushakov, Sergey
N" <us...@int.com.ru>
Sent: Tuesday, October 30, 2001 10:24 PM
Subject: Re: launching Tomcat from Java


> The key question is whether you want Tomxcat to run in the same JVM or
> not.  For running in a separate JVM, you're not going to have a lot of
> choice about using Runtime.exec().
>
> To run in the same JVM, Bootstrap.main() currently has a "System.exit(0)"
> at the end which needs to be removed.  I'll make that change in the Tomcat
> code so that this will not be a problem in future versions.
>
> For same-JVM use, you can also consider using the
> org.apache.catalina.startup.Embedded class to set up Tomcat components the
> way you want them.  This is the technique used by the J2EE 1.3 RI to embed
> Tomcat as the web container, and is useful when you want to maintain your
> own configuration information independent of the "server.xml" file.  This
> class has a dummy main() method that illustrates its use.
>
> Craig
>
>
> On Tue, 30 Oct 2001, Ushakov, Sergey N wrote:
>
> > Date: Tue, 30 Oct 2001 11:04:44 +0300
> > From: "Ushakov, Sergey N" <us...@int.com.ru>
> > Reply-To: Tomcat Users List <to...@jakarta.apache.org>,
> >      "Ushakov, Sergey N" <us...@int.com.ru>
> > To: tomcat-user@jakarta.apache.org
> > Subject: launching Tomcat from Java
> >
> > Hello,
> >
> > I am writing a java app that is intended as sort of control center. It
> > should also occasionally start and stop Tomcat.
> >
> > Unfortunately I still cannot find a better solution for this than
> > Runtime.exec("...startup...", ...).
> >
> > My attempts to use Bootstrap.main() also give a good result ;)  But only
> > until I wish to stop Tomcat. Then Bootstrap.main ("stop") just kills the
> > whole JVM... :(
> >
> > Still avoiding Runtime.exec() would be great. Any ideas? Any ways to
> > parameterize Catalina/Bootstrap/etc ?
> >
> > Regards,
> > Sergey Ushakov
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: launching Tomcat from Java

Posted by "Craig R. McClanahan" <cr...@apache.org>.
The key question is whether you want Tomxcat to run in the same JVM or
not.  For running in a separate JVM, you're not going to have a lot of
choice about using Runtime.exec().

To run in the same JVM, Bootstrap.main() currently has a "System.exit(0)"
at the end which needs to be removed.  I'll make that change in the Tomcat
code so that this will not be a problem in future versions.

For same-JVM use, you can also consider using the
org.apache.catalina.startup.Embedded class to set up Tomcat components the
way you want them.  This is the technique used by the J2EE 1.3 RI to embed
Tomcat as the web container, and is useful when you want to maintain your
own configuration information independent of the "server.xml" file.  This
class has a dummy main() method that illustrates its use.

Craig


On Tue, 30 Oct 2001, Ushakov, Sergey N wrote:

> Date: Tue, 30 Oct 2001 11:04:44 +0300
> From: "Ushakov, Sergey N" <us...@int.com.ru>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>,
>      "Ushakov, Sergey N" <us...@int.com.ru>
> To: tomcat-user@jakarta.apache.org
> Subject: launching Tomcat from Java
>
> Hello,
>
> I am writing a java app that is intended as sort of control center. It
> should also occasionally start and stop Tomcat.
>
> Unfortunately I still cannot find a better solution for this than
> Runtime.exec("...startup...", ...).
>
> My attempts to use Bootstrap.main() also give a good result ;)  But only
> until I wish to stop Tomcat. Then Bootstrap.main ("stop") just kills the
> whole JVM... :(
>
> Still avoiding Runtime.exec() would be great. Any ideas? Any ways to
> parameterize Catalina/Bootstrap/etc ?
>
> Regards,
> Sergey Ushakov
>
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>