users@glassfish.java.net

Re: Glassfish crashing or just disappearing

From: <glassfish_at_javadesktop.org>
Date: Wed, 10 Mar 2010 19:52:51 PST

assuming you are running with the SecurityManager enabled, then you could try deploying the attached web archive. It can help us see if something inside your appserver process is calling exit. As Alexis, noted, exit is access control protected, so if that is what is happening, it will either be happening from within the appserver codebase, or perhaps from code loaded from a privileged location in the file system. Anyway, you can use the attached program to replace the SecurityManager of your server with one that will log a stack trace (to server.log) if a call to exit occurs within the appserver process.

Note that if your appserver process is being exteranlly killed, or dieing as a result of a vm crash, then deploying this app will be unlikely to show us the cause. Alexis has provided suggestions to try to determine if either of those things are happening.

The app will needs some special privileges, and the required grants (as best I could predict them) are in the second attachment.

0. stop you appserver
1. append the contents of that file to the end of server.policy.
2. start your appserver (with the SecurityManager enabled)
3. asadmin deploy TrapExit.war

4. configure the trapping security manager by issuing the following request (replace hostname and portnumber to match your config)

http://hostname:portnumber/TrapServlet/request?setSecurityManager

5. check server.log for any access control exceptions. there should not be any. if there
are, you may need to make some changes to the grants i sent you.

6. test that exit will be trapped by issuing the following command. this should cause the
new securitymanager to print a stack trace (in server.log) showing the source of the call to exit.
In this case, the call will originate from "TheServlet" within the web application. I expect that you should also see an access violation, because we did not grant "Servlet" the permission required to call exit. that is as it should be.

http://hostname:portnumber/TrapServlet/request?exitServer

7. if all that works for you, then you should proceed and do whatever has been causing the appserver to disappear. Assuming you can reproduce the shutdown, look in server.log to see if you can find a corresponding trace.

8. to revert your system, restart the appserver, and undeploy the TrapExit app.

-----
if you need to revise the grants (I sent you), you should use the admin-gui to set the level of the security logger to FINE. This will cause the policy system to print out the "domain that failed", when there is an access control exception. the domain that failed msg will indicate both the permission that needs to be granted, and the codesource that needs to be granted the permission.

that's about it. this is probably a long shot, but if something inside the appserver process is successfully calling exit, then this should show you what is doing it. If nothing gets detected, then that would suggest add credence to the appserver being killed by an external process, or as a result of a vm crash.
[Message sent by forum member 'monzillo' (ronald.monzillo_at_sun.com)]

http://forums.java.net/jive/thread.jspa?messageID=391152