Groups > Weblogic > WebLogic Servlet > EventListener Class and ways to recognize weblogic down state




EventListener Class and ways to recognize weblogic down
state

EventListener Class and ways to recognize weblogic down state
Mon, 25 Feb 2008 10:20:59 -080
Hello,
I have a eventListener class defined in web.xml and currently deployed on
weblogic 92.

TestThresholdActivator implements ServletContextListener,
      NotificationListener

The above class is invoked every 5 secs.
When this class is invoked it retrieves a DB connection via a JNDI lookup and
the connection Pool is created during domain creation of weblogic.

This DB look up happens in the below method..via a private method
getConnectionFromJNDI and the JNDI name gets passed to it,

This class also implements the interfaces
contextDestroyed() and contextInitialized()

This issue here is that when weblogic server is bounced ..this state is not
recongnized and we end up looking up JNDI for a DB connection and error out
since JNDI lookup fails.

How can I fix this issue? Is this possible to recognize this state so that I
need not lookup JNDI and just return and the next 5 secs when this class is
invoked we would have weblogic up and get a success for JNDI lookup.
Also..I am not sure if using JNDI lookup is the right way to do this  and also
if the location of code where I do a JNDI lookup is right ..shuld this be done
in the contextInitialized() method?
Please advise

 public void handleNotification(Notification notif, Object handback)
   {
Post Reply
about | contact