aspose file tools*
The moose likes Tomcat and the fly likes (Programmaticly) shutdown Tomact on java.lang.Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "(Programmaticly) shutdown Tomact on java.lang.Error" Watch "(Programmaticly) shutdown Tomact on java.lang.Error" New topic
Author

(Programmaticly) shutdown Tomact on java.lang.Error

Chuck Norris
Greenhorn

Joined: Mar 13, 2006
Posts: 1
Hi there,

we use tomcat and axis to write some webservices. i discovered that when i throw an java.lang.Error at any place (e.g. OutOfMemory Error) tomcat will not shutdown.
As far as i know Error's mean that something in the JVM went wrong and it should be shutdown/ended when an Error occurs.
What whould be the best way to manually shutdown tomcat if an Error occurs?
Maybe a callback tomcat offers or something like that?

Or something like
catch(Throwable t) {
if(t instanceof Error) {
org.apache...Bootstrap.main(new String[]{"stop"});
}
}
at the correct place?

thanks for any help

kind regards
-chuck
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12682
    
    5
I suppose you could use System.exit() but you may have to specifically set the security manager permission to call it.
Another alternative might be to throw an UnavailableException if you want to keep the rest of the server running. Trying to do anything after an OutOfMemoryError is pretty tricky, let us know what you come up with.
Bill


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: (Programmaticly) shutdown Tomact on java.lang.Error
 
Similar Threads
Database file Validation
shutdown error
BLACK ZONE alert on Stopping Tomcat Server
start/stop Tomcat 7 windows service on 64-bit results in error
Tomcat3.2.2