Create a Class that extends ApplicationLifecycleListener.
ApplicationListener.java
package demo;
import weblogic.application.ApplicationException;
import weblogic.application.ApplicationLifecycleEvent;
import weblogic.application.ApplicationLifecycleListener;;
public class ApplicationListener extends ApplicationLifecycleListener {
public void preStart(ApplicationLifecycleEvent evt) {
System.out.println(“Event preStart received”);
}
public void postStart(ApplicationLifecycleEvent evt) {
System.out.println(“Event postStart received”);
}
public void preStop(ApplicationLifecycleEvent evt) {
System.out.println(“Event preStop received”);
}
public void postStop(ApplicationLifecycleEvent arg0) throws ApplicationException {
System.out.println(“Event postStop received”);
}
}
Add the listener element in the weblogic-application.xml description present under EARMETA-INF
weblogic-application.xml
<weblogic-application
xmlns=”http://www.bea.com/ns/weblogic/90″
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
<listener>
<listener-class>demo.ApplicationListener</listener-class>
</listener>
</weblogic-application>
1. Compile the ApplicationListener class and place it under EARAPP-INFclasses
2. Create a simple Web Application and specify the web module in the application.xml present under EARMETA-INF
application.xml
<module>
<web>
<web-uri>TestApp</web-uri>
<context-root>TestApp</context-root>
</web>
</module>
5. Deploy the EAR.
Quickly and Simple.
very helpful!
Thanks!
Excellent eg…awesome
thanks Narendra! 🙂
Please let me know if weblogic.jar is sufficient to load these imports or we need some other jars as we’ll.
Please create a wlfullclient.jar and use that.. steps are there on weblogic wonders
In which jar file I can find this class weblogic.application.ApplicationLifecycleListener?
I need to jar file.
Thanks
Uma
Hi Uma,
You can use the jarscan untility to find out
https://weblogic-wonders.com/weblogic/2011/01/26/finding-jar-files-using-jarscan/