I'm not sure if this will do exacty what you want, but the app server allows you to deploy a lifecycle module which is started up when the app server starts up and is notified during shutdown as well.
It is not by itself a mechanism for EJBs to learn of app server start-up and shutdown, but you might be able to use a life cycle module and your EJBs together to accomplish what you want to do.
Read this section of the documentation and see if this might help meet your needs.
http://docs.sun.com/app/docs/doc/819-3659/6n5s6m5b0?a=view
- Tim