2 Replies Latest reply on May 30, 2013 1:43 AM by Nicklas Karlsson

    Does the default NamingContext support NamingListener?

    Jim Woodgate Newbie

      Using jboss-as-7.1.1.Final

       

      I created a subcontext to store a set of objects:

       

      Context initialContext = new InitialContext();

      Context context = initialContext.createSubcontext("java:/app/objs");

       

      At this point I can bind and lookup just fine:

       

      context.bind("a",a); // can be looked up as either "java:app/objs/a" or just "a" from the subcontext

       

      According to the documentation if I use:

       

      EventContext eventContext = (EventContext)initialContext.lookup("");

       

      and eventContext is not null, I should be able to attach a NamingListener to get notifications.  I've tried countless permutations of where EventContext's initial context looks + where target looks, but neither the NamespaceChangeListener nor the ObjectChangeListener ever fires.

       

      For example:

       

      Given the above bind and eventContext:

       

      eventContext.addNamingListener("java:app/objs/a",EventContext.OBJECT_SCOPE, new ObjectChangeListener() {...

       

      objectChanged never fires and attaching a NamespaceChangeListener didn't fire when new objects were added.