We are using weblogic version 4.5.1.On running a JSP file with statement "System.exit(0)" weblogic shuts down automatically.This doesn't happen in one of our testing environments.Could you pls explain about this problem.
Thanks in advance,
As far as I know, System.exit() shuts down the currently executing JVM. That might explain the behaviour you are seeing. Cant explain why you are not seeing the same in the other environment
System.exit() in the context of servlets or JSP pages does not make sense to me. JSPs run as servlets, they are meant to be servicing requests for as long as they are up. Is there a reason to intentionally shutdown the servlet?. If you are using System.exit() as a way of handling errors, consider redirecting to an error page as it is a more common approach to handling exceptions. Alternatively, you can use the "return" statement as well, if that is a reasonable thing to do.
Perhaps you can shed some light on your reasons for using the exit call.
Yeah, using System.exit() doesn't make sense in a servlet
or JSP, as mentioned above. It should terminate the JVM.
I wonder if your "test environment" has some sort of
watchdog process or wrapper script which restarts a JVM
when it exits or fails. Some app servers, like iPlanet,
will do this... in iPlanet's case, a separate process
will indeed keep watch on the various JVM processes
and restart them as needed. This is for reliability
purposes. Could this be happening to you?