2013/4/1 Benson Margulies <ben...@basistech.com>: > When embedding Tomcat, I'd like to create some objects purely from code -- > I don't want to bother to express them as XML -- and then pick them up > inside webapps. Now, calling enableNaming() on Tomcat sets up a bunch of > environment, but does not actually create and JNDI objects. If I call > enableNaming(), and then make JNDI calls before calling start(), should I > expect that to work?
1. No, JNDI binds to TCCL (Thread.currentThread().getContextClassLoader()). Before you call start() the webapp classloader is not initialized and has not been started. So you cannot bind your JNDI to it. 2. The magic that translates XML into java calls is called Digester (http://commons.apache.org/digester) You may start a standalone Tomcat and try to debug it. https://wiki.apache.org/tomcat/FAQ/Developing#Debugging The place to look into is org.apache.catalina.core.NamingContextListener That is the component that translates configuration objects created when parsing context.xml into JNDI objects. 3. See thread "Register static JNDI env entry dynamically" from 2 weeks ago. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org