1 22 package org.jboss.test.isolation.web.c; 23 24 import javax.servlet.ServletContextListener ; 25 import javax.servlet.ServletContextEvent ; 26 27 import org.jboss.logging.Logger; 28 29 35 public class ContextListener implements ServletContextListener 36 { 37 private static final Logger log = Logger.getLogger(ContextListener.class); 38 39 static 40 { 41 test(); 42 } 43 44 public void contextInitialized(ServletContextEvent e) 45 { 46 test(); 47 } 48 49 public void contextDestroyed(ServletContextEvent e) 50 { 51 } 52 53 protected static void test() 54 { 55 dump("TCL=", Thread.currentThread().getContextClassLoader()); 56 dump("MyCL=", ContextListener.class.getClassLoader()); 57 dump("LoggerCL=", log.getClass().getClassLoader()); 58 59 if (ContextListener.class.getClassLoader() != log.getClass().getClassLoader()) 60 throw new RuntimeException ("Expected log4j logger to be from same classloader"); 61 } 62 63 protected static void dump(String context, ClassLoader cl) 64 { 65 System.out.println(context + cl); 66 } 67 } 68 | Popular Tags |