1 Reply Latest reply on Sep 26, 2003 6:29 PM by Raja

    Application deployment/undeployment listener

    hemendra Newbie

      Hi,

      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,
      Hemendra

        • 1. Re: Application deployment/undeployment listener
          Raja Master

          1) You can write a MBean and use the createService and destroyService methods of MBeanSupport Class to do your startup and shutdown actions. You can also bundle ur ear within the sar so they are treated as a single unit. This wud be a jboss specific solution

          2) You can use the unsetContext to do the unloading and setContext to do the startup operations. In our case, we have a few MDBs and they need to grab properties when the app deploys. So we use the setMEssageDrivenContext to get it . Note this is in Weblogic but shud be the same in Jboss.

          -Raj