1 17 18 19 package org.apache.catalina.startup; 20 21 22 import java.lang.reflect.Method ; 23 import org.apache.catalina.Container; 24 import org.apache.tomcat.util.digester.Rule; 25 import org.xml.sax.Attributes ; 26 27 28 37 38 public class CopyParentClassLoaderRule extends Rule { 39 40 41 43 44 47 public CopyParentClassLoaderRule() { 48 } 49 50 51 53 54 61 public void begin(String namespace, String name, Attributes attributes) 62 throws Exception { 63 64 if (digester.getLogger().isDebugEnabled()) 65 digester.getLogger().debug("Copying parent class loader"); 66 Container child = (Container) digester.peek(0); 67 Object parent = digester.peek(1); 68 Method method = 69 parent.getClass().getMethod("getParentClassLoader", new Class [0]); 70 ClassLoader classLoader = 71 (ClassLoader ) method.invoke(parent, new Object [0]); 72 child.setParentClassLoader(classLoader); 73 74 } 75 76 77 } 78 | Popular Tags |