Search code examples
javaweblogic

Trigger a function upon Weblogic termination


Is there anyway to capture weblogic termination event and trigger a Java function?

My weblogic version is V10.0

Thank you,


Solution

  • You could imlement a javax.servlet.ServletContextListener

    public class MyServletContextListener implements ServletContextListener {
      public void contextInitialized(ServletContextEvent e) {
      }
    
      public void contextDestroyed(ServletContextEvent e) {
      }
    }
    

    and add it to the web.xml.

    <listener>
        <listener-class>MyServletContextListener</listener-class>
    </listener>
    

    There you can handle the shutdwn of the weblogic container.