geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r934679 - /geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
Date Fri, 16 Apr 2010 03:54:39 GMT
Author: xuhaihong
Date: Fri Apr 16 03:54:39 2010
New Revision: 934679

URL: http://svn.apache.org/viewvc?rev=934679&view=rev
Log:
Set thread context classloader, as Tomcat needs it to load Connector MBean while adding connector

Modified:
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java?rev=934679&r1=934678&r2=934679&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
Fri Apr 16 03:54:39 2010
@@ -92,6 +92,7 @@ public class TomcatContainer implements 
     private final WebManager manager;
     private static boolean first = true;
     private final BundleContext bundleContext;
+    private final ClassLoader classLoader;
 
     /**
      * GBean constructor (invoked dynamically when the gbean is declared in a plan)
@@ -116,7 +117,7 @@ public class TomcatContainer implements 
         if (engineGBean == null && server == null) throw new IllegalArgumentException("Server
and EngineGBean cannot both be null.");
 
         this.bundleContext = bundleContext;
-
+        this.classLoader = classLoader;
         // Register a stream handler factory for the JNDI protocol
         URLStreamHandlerFactory streamHandlerFactory =
             new DirContextURLStreamHandlerFactory();
@@ -339,7 +340,13 @@ public class TomcatContainer implements 
     }
 
     public void addConnector(Connector connector) {
-        embedded.addConnector(connector);
+        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+        try {
+            Thread.currentThread().setContextClassLoader(classLoader);
+            embedded.addConnector(connector);
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldClassLoader);
+        }
     }
 
     public void removeConnector(Connector connector) {



Mime
View raw message