public void doStart() throws Exception { // See the note of TomcatContainer::addContext container.addContext(this); // Is it necessary - doesn't Tomcat Embedded take care of it? // super.start(); //register the classloader <> dir context association so that tomcat's jndi based getResources works. DirContext resources = context.getResources(); DirContextURLStreamHandler.bind(classLoader, resources); log.debug("TomcatWebAppContext started for " + path); }
public void doStart() throws Exception { // See the note of TomcatContainer::addContext container.addContext(this); // Is it necessary - doesn't Tomcat Embedded take care of it? // super.start(); //register the classloader <> dir context association so that tomcat's jndi based getResources works. DirContext resources = context.getResources(); if (resources == null) { throw new IllegalStateException("JNDI environment was not set up correctly due to previous error"); } DirContextURLStreamHandler.bind(classLoader, resources); if (context instanceof StandardContext) statsProvider = new ModuleStats((StandardContext)context); log.debug("TomcatWebAppContext started for " + path); }
/** * Bind current thread, both for CL purposes and for JNDI ENC support * during : startup, shutdown and realoading of the context. * * @return the previous context class loader */ protected ClassLoader bindThread() { ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader(); if (getResources() == null) return oldContextClassLoader; if (getLoader().getClassLoader() != null) { Thread.currentThread().setContextClassLoader (getLoader().getClassLoader()); } DirContextURLStreamHandler.bind(getResources()); return oldContextClassLoader; }
/** * Bind current thread, both for CL purposes and for JNDI ENC support * during : startup, shutdown and realoading of the context. * * @return the previous context class loader */ private ClassLoader bindThread() { ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader(); if (getResources() == null) return oldContextClassLoader; if (getLoader().getClassLoader() != null) { Thread.currentThread().setContextClassLoader (getLoader().getClassLoader()); } DirContextURLStreamHandler.bind(getResources()); if (isUseNaming()) { try { ContextBindings.bindThread(this, this); } catch (NamingException e) { // Silent catch, as this is a normal case during the early // startup stages } } return oldContextClassLoader; }
@Override protected void startInternal() throws LifecycleException { super.startInternal(); final ClassLoader webappCl = super.getClassLoader(); tomEEClassLoader = new TomEEClassLoader(appPath, appClassLoader, webappCl); try { DirContextURLStreamHandler.bind(tomEEClassLoader, getContainer().getResources()); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); throw new LifecycleException("start: ", t); } }
DirContextURLStreamHandler.bind(classLoader, this.container.getResources());
DirContextURLStreamHandler.bind ((ClassLoader) classLoader, this.container.getResources());
DirContextURLStreamHandler.bind(classLoader, this.container.getResources());
DirContextURLStreamHandler.bind(classLoader, this.container.getResources());
DirContextURLStreamHandler.bind(classLoader, this.container.getResources());
DirContextURLStreamHandler.bind(classLoader, this.container.getResources());
DirContextURLStreamHandler.bind(classLoader, this.container.getResources());
DirContextURLStreamHandler.bind(loader.getClassLoader(), getResources());