I have written a few Session, Entity and Message Driven Beans. I have a requirement of some of these beans using certain application level resources that I want to allocate at the time application is deployed. These resources need to be deallocated just before the application is undeployed.
Although I am able to do what I described above by writing a bootstrap servlet that gets loaded on startup (using <load-on-startup> tag in web.xml), I was wondering if there is a standard way to do so.
Use of the bootstrap servlet also brings along another problem. The EJBs gets undeployed before the servlets destroy() method gets called. As such, it is not possible for me to reset certain EJB state information before undeploying the application.
Any help in this matter will be highly appreciated.
Thanks in advance,