tags:

views:

47

answers:

3

Hi,

I need to do some clean up (release open ports,etc.) before my EJB Session Bean is being undeployed, is there a way to detect this?

The EJB is running on Weblogic 10.0.

A: 

Can you not make use of the session bean lifecycle by using @PreDestroy as illustrated here ?

Brian Agnew
it sounded great to me bu somehow it didnt work on Weblogic 10.
alb
A: 

Listen to the lifcecycle events using the ServletContextListener interface.

Implement the interface in a class, and register it in web.xml:

 <listener>
<listener-class>
 my-class-with-servlet-contextlistener-interface
</listener-class>
  </listener>
krosenvold
Aren't we looking at session beans, not servlets ?
Brian Agnew
Assuming the whole EAR is being undeployed your servlets go with them.
krosenvold
A: 

Solved the issue in a Weblogic-specific way by implementing an ApplicationLifecycleListener. Details can be seen here

alb