[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Tomcat + System.exit(0) will shutdown tomcat

Posted on 2003-03-01
4
Medium Priority
?
2,146 Views
Last Modified: 2013-11-24
I have tomcat as my application server.

And there are nearly 10 context running under my tomcat.All are my application  which are very critical, and they can't go offline by any means. They should be online 24x7 running.

I have tested that in any of application i.e.,JSP or Servelt or Bean...
If that contains System.exit(0);  or System.exit(-1);
It will shut down tomcat.

I know that System.exit(0); is used for normal op abnoraml shutdown of JVM.

So there could be a senario of any person putting a small JSP with System.exit() and running that, it will shutdown my tomcat, that means all my application will go offline and i have to start my tomcat again.

And there could be another senario also the user putting the servlet or JSP in a startup servlet of tomcat, so whenever a tomcat is started, after that my context will comeup and startup servlet will be invoked and it contains System.exit(); and this will shutdown tomcat.


Is there anyway to stop that...means not accepting System.exit(0) instruction from any context running under tomcat?

could anyone help out with this.
0
Comment
Question by:vijay_trina
3 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 200 total points
ID: 8048152
Assuming that your interpretation of the effects of System.exit is correct (i'm not sure about this) i think you might be able to install a SecurityManager and disallow an exit in its checkExit method
0
 

Expert Comment

by:CleanupPing
ID: 9058990
vijay_trina:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 35

Expert Comment

by:TimYates
ID: 9677827
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept CEHJ's comment as answer.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TimYates
EE Cleanup Volunteer
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month10 days, 12 hours left to enroll

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question