views:

111

answers:

3

What would happen if someone writes System.exit() in a servlet would the server or the application crash?

+2  A: 

The JVM running the servlet container would terminate, so, yes.

aioobe
Well, I would hope that most would be running with a security manager and be configured to restrict this. If so, then the answer is No. So the correct answer is, depends on if a security manager is in use and the security policy is correctly configured/restricted.
Kevin Brock
+7  A: 

Maybe! The container should have modified the security manager (SecurityManager.checkExit()) so the call may result in an AccessControlException. No webapp should be able to shutdown the server.

Arne Burmeister
+2  A: 

There is an answer to this question already here: http://tomcat.apache.org/tomcat-5.5-doc/security-manager-howto.html

J K