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)