0 Replies Latest reply on Oct 10, 2002 4:12 AM by Alberto

    Be notified when a EJB is hot un/deployed

    Alberto Newbie

      Hi all !

      Is there a way to be notified when an specific EJB is deployed/undeployed (e.g. due to hot re-deploy) ?

      I was wondering how to implement it, deciding that the MOST elegant way was to LISTEN for JNDI namespace changes -- Assuming that during hot-deploy, my EJB will be deregistered and registered again.
      I think I'm right about this issue but, searching on the JNDI API, I have found that a EventContext is required to be added as a namespace change listener (addNamingListener method). Thus, my code looks like:

      The question is: how to locate an EventContext ? The JNDI Java tutorial at talks about some lookup on an empty string, ... but I always get a NamingContext.

      I give you some code snippet I was trying:

      EventDirContext ctx = (EventDirContext) (new InitialDirContext()).lookup(""); (here comes the ClassCastException)
      ctx.addNamingListener("ejb/util/config",EventContext.OBJECT_SCOPE,this);