Lin Ren
2018-04-11 06:40:57 UTC
Hi all,
Â
Here is a question for JNDI EventContext, I have a tree like JNDI name, given it âa/b/c/dâ, and I bind the name as below:
Â
final InitialContext context = new InitialContext();
context.addToEnvironment(DEEP_BINDING_PROP, true);
Context contextNew = contextNew.createSubcontext(âaâ);
contextNew = contextNew.createSubcontext(âbâ);
contextNew = contextNew.createSubcontext(âcâ);
contextNew.bind (âdâ, new AA());
Â
And now I need add a NamespaceChangeListener under âa/b/câ, I tried to do that as below:
  namingListener = new EventReceiversListener(this);
  EventContext eventContext = (EventContext)context.lookup(âa/b/câ);
  eventContext.addNamingListener("", EventContext.ONELEVEL_SCOPE, namingListener);
                                                                                                                      Â
But Jetty says âorg.eclipse.jetty.jndi.NamingContext cannot be cast to javax.naming.event.EventContextâ. Can anyone know how to do with that?
Â
Â
Thanks!
Â
Â
Here is a question for JNDI EventContext, I have a tree like JNDI name, given it âa/b/c/dâ, and I bind the name as below:
Â
final InitialContext context = new InitialContext();
context.addToEnvironment(DEEP_BINDING_PROP, true);
Context contextNew = contextNew.createSubcontext(âaâ);
contextNew = contextNew.createSubcontext(âbâ);
contextNew = contextNew.createSubcontext(âcâ);
contextNew.bind (âdâ, new AA());
Â
And now I need add a NamespaceChangeListener under âa/b/câ, I tried to do that as below:
  namingListener = new EventReceiversListener(this);
  EventContext eventContext = (EventContext)context.lookup(âa/b/câ);
  eventContext.addNamingListener("", EventContext.ONELEVEL_SCOPE, namingListener);
                                                                                                                      Â
But Jetty says âorg.eclipse.jetty.jndi.NamingContext cannot be cast to javax.naming.event.EventContextâ. Can anyone know how to do with that?
Â
Â
Thanks!
Â