vanzylv
vanzylv

Reputation: 851

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.

Upvotes: 3

Views: 3661

Answers (2)

Bit-Man
Bit-Man

Reputation: 546

May be a bit later to provide you an answer but a listener URI, unless in WebLogic 12, can also be set to avoid adding class files to plain ear file :

<?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-uri>startup.jar</listener-uri>
</listener>
</weblogic-application>

Upvotes: 2

Apostolos Emmanouilidis
Apostolos Emmanouilidis

Reputation: 7197

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.

Upvotes: 1

Related Questions