You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Brett Porter <bp...@f2network.com.au> on 2001/10/22 08:20:38 UTC

automatic shutdown from servlet.init() that is load-on-startup

Hi,

I saw a message a while back on this, but don't remember a solution and 
failed to find it in the archives.

I am looking to shutdown Tomcat 4 if a set of initialisation functions 
fail. These functions are in the init() method of a servlet that is set 
to load on startup (the first).

Throwing a ServletException doesn't stop Tomcat, and I tried calling 
Bootstrap.main( new String[] { "stop" } ); but that didn't unbind it 
from the port either (it didn't give me any log messages either, but it 
did prevent anything executing after that :)

Thanks,
Brett Porter



Re: automatic shutdown from servlet.init() that is load-on-startup

Posted by simon <si...@lexues.co.jp>.
Whoops!  This is for Tomcat 3.2.3.

Sorry.

----- Original Message ----- 
From: "simon" <si...@lexues.co.jp>
To: <to...@jakarta.apache.org>
Sent: Monday, October 22, 2001 4:09 PM
Subject: Re: automatic shutdown from servlet.init() that is load-on-startup


> The way to shutdown tomcat is to use the class
> 
> org.apache.tomcat.task.StopTomcat
> 
> which sends a shutdown message to the ajp12 port.
> 
> An example of it's usage is in
> 
> Tomcat.java
> (src/share/org/apache/tomcat/startup)
> 
> hope this helps
> 
> simon
> 
> ----- Original Message ----- 
> From: "Brett Porter" <bp...@f2network.com.au>
> To: <to...@jakarta.apache.org>
> Sent: Monday, October 22, 2001 3:20 PM
> Subject: automatic shutdown from servlet.init() that is load-on-startup
> 
> 
> > Hi,
> > 
> > I saw a message a while back on this, but don't remember a solution and 
> > failed to find it in the archives.
> > 
> > I am looking to shutdown Tomcat 4 if a set of initialisation functions 
> > fail. These functions are in the init() method of a servlet that is set 
> > to load on startup (the first).
> > 
> > Throwing a ServletException doesn't stop Tomcat, and I tried calling 
> > Bootstrap.main( new String[] { "stop" } ); but that didn't unbind it 
> > from the port either (it didn't give me any log messages either, but it 
> > did prevent anything executing after that :)
> > 
> > Thanks,
> > Brett Porter
> > 
> > 
> > 
> 
> 


Re: automatic shutdown from servlet.init() that is load-on-startup

Posted by simon <si...@lexues.co.jp>.
The way to shutdown tomcat is to use the class

org.apache.tomcat.task.StopTomcat

which sends a shutdown message to the ajp12 port.

An example of it's usage is in

Tomcat.java
(src/share/org/apache/tomcat/startup)

hope this helps

simon

----- Original Message ----- 
From: "Brett Porter" <bp...@f2network.com.au>
To: <to...@jakarta.apache.org>
Sent: Monday, October 22, 2001 3:20 PM
Subject: automatic shutdown from servlet.init() that is load-on-startup


> Hi,
> 
> I saw a message a while back on this, but don't remember a solution and 
> failed to find it in the archives.
> 
> I am looking to shutdown Tomcat 4 if a set of initialisation functions 
> fail. These functions are in the init() method of a servlet that is set 
> to load on startup (the first).
> 
> Throwing a ServletException doesn't stop Tomcat, and I tried calling 
> Bootstrap.main( new String[] { "stop" } ); but that didn't unbind it 
> from the port either (it didn't give me any log messages either, but it 
> did prevent anything executing after that :)
> 
> Thanks,
> Brett Porter
> 
> 
> 


Re: automatic shutdown from servlet.init() that is load-on-startup

Posted by Brett Porter <bp...@f2network.com.au>.
I realise this isn't very well-behaved, but any others will probably be 
dealing with the same problems. At this point in time there is only one 
web application.

Perhaps there is another solution - eg send an email on failure and get 
an administrator to check in on the problem.

Cheers,
Brett

E B wrote:

>Do you mean a webapp should be able to stop the
>appserver tomcat ?
>If this is what you wanted, then will other webapps be
>
>happy with this ?
>
>
>
> --- Brett Porter <bp...@f2network.com.au> wrote: >
>Hi,
>
>>I saw a message a while back on this, but don't
>>remember a solution and 
>>failed to find it in the archives.
>>
>>I am looking to shutdown Tomcat 4 if a set of
>>initialisation functions 
>>fail. These functions are in the init() method of a
>>servlet that is set 
>>to load on startup (the first).
>>
>>Throwing a ServletException doesn't stop Tomcat, and
>>I tried calling 
>>Bootstrap.main( new String[] { "stop" } ); but that
>>didn't unbind it 
>>from the port either (it didn't give me any log
>>messages either, but it 
>>did prevent anything executing after that :)
>>
>>Thanks,
>>Brett Porter
>>
>> 
>>
>
>____________________________________________________________
>Nokia Game is on again. 
>Go to http://uk.yahoo.com/nokiagame/ and join the new
>all media adventure before November 3rd.
>




Re: automatic shutdown from servlet.init() that is load-on-startup

Posted by E B <he...@yahoo.co.uk>.
Do you mean a webapp should be able to stop the
appserver tomcat ?
If this is what you wanted, then will other webapps be

happy with this ?



 --- Brett Porter <bp...@f2network.com.au> wrote: >
Hi,
> 
> I saw a message a while back on this, but don't
> remember a solution and 
> failed to find it in the archives.
> 
> I am looking to shutdown Tomcat 4 if a set of
> initialisation functions 
> fail. These functions are in the init() method of a
> servlet that is set 
> to load on startup (the first).
> 
> Throwing a ServletException doesn't stop Tomcat, and
> I tried calling 
> Bootstrap.main( new String[] { "stop" } ); but that
> didn't unbind it 
> from the port either (it didn't give me any log
> messages either, but it 
> did prevent anything executing after that :)
> 
> Thanks,
> Brett Porter
> 
>  

____________________________________________________________
Nokia Game is on again. 
Go to http://uk.yahoo.com/nokiagame/ and join the new
all media adventure before November 3rd.