Search code examples
javaweblogic

Weblogic ApplicationLifecycleListener not firing


I have a bean that contains a ApplicationLifecycleListener.Like so :

package vanzylvi.test;

import weblogic.application.ApplicationLifecycleEvent;

import weblogic.application.ApplicationLifecycleListener;

public class TestApplicationListener  extends ApplicationLifecycleListener {

     public void preStart(ApplicationLifecycleEvent evt) {
         System.out.println("preStart GO GO GO");
     }
}

and in my weblogic-application.xml

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
<listener>
     <listener-class>vanzylvi.test.TestApplicationListener</listener-class>
</listener>
</weblogic-application>

I can never get the preStart bit to fire,any help would be appreciated.


Solution

  • I'm pretty sure that the problem is java.lang.ClassNotFoundException since I faced the same issue in the past. In order to fix it, compile the TestApplicationListener class and place it under your EarContent/APP-INF/classes. Your EarContent/APP-INF/classes should contain vanzylvi/test/TestApplicationListener.class.

    Your weblogic-application.xml and the TestApplicationListener are correct.

    I hope this helps you.