tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Santos <>
Subject Getting StandardServer's NamingContext?
Date Tue, 21 Nov 2006 16:24:24 GMT

Is there a better way to get StandardServer's NamingContext than this?  I'm
writing a custom realm and I need some puggable resources (I'm using
GlobalNamingResources to configure these, it's the cleanest way I could come
up with)

// code is from a RealmBase-derived class start() method

Container c;
for(c = this.container; c.getParent() != null; c = c.getParent());

if(!(c instanceof Service)) {
    throw new SomeException("Can't find my Service, that's wierd.");

Service service = (Service)c;
StandardServer server = (StandardServer)service.getServer();
for(LifecycleListener ll : server.findLifecycleListeners()) {
    if(ll instanceof NamingContextListener) {
        rootNamingContext = ((NamingContextListener)ll).getNamingContext();


View this message in context:
Sent from the Tomcat - Dev mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message