Author: markt
Date: Mon Nov  2 22:28:35 2009
New Revision: 832158

URL: http://svn.apache.org/viewvc?rev=832158&view=rev
Log:
Allow per instance log4j.properties, JAR files (JDBC drivers) etc

Modified:
    tomcat/tc6.0.x/trunk/   (props changed)
    tomcat/tc6.0.x/trunk/RUNNING.txt
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/conf/catalina.properties
    
tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/ClassLoaderFactory.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc6.0.x/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov  2 22:28:35 2009
@@ -1 +1 @@
-/tomcat/trunk:601180,606992,612607,630314,640888,652744,653247,673796,673820,677910,683969,683982,684001,684081,684234,684269-684270,685177,687503,687645,689402,690781,691392,691805,692748,693378,694992,695053,695311,696780,696782,698012,698227,698236,698613,699427,699634,701355,709294,709811,709816,710063,710066,710125,710205,711126,711600,712461,712467,718360,719119,719124,719602,719626,719628,720046,720069,721040,721286,721708,721886,723404,723738,726052,727303,728032,728768,728947,729057,729567,729569,729571,729681,729809,729815,729934,730250,730590,731651,732859,732863,734734,740675,740684,742677,742697,742714,744160,744238,746321,746384,746425,747834,747863,748344,750258,750291,750921,751286-751287,751289,751295,753039,757335,757774,758365,758596,758616,758664,759074,761601,762868,762929,762936-762937,763166,763183,763193,763228,763262,763298,763302,763325,763599,763611,763654,763681,763706,764985,764997,765662,768335,769979,770716,770809,770876,776921,776924,776935,77
 
6945,777464,777466,777576,777625,778379,778523-778524,781528,781779,782145,782791,783316,783696,783724,783756,783762,783766,783863,783934,784453,784602,784614,785381,785688,785768,785859,786468,786487,786490,786496,786667,787627,787770,787985,789389,790405,791041,791184,791194,791224,791243,791326,791328,791789,792740,793372,793757,793882,793981,794082,794673,794822,795043,795152,795210,795457,795466,797168,797425,797596,797607,802727,802940,804462,804544,804734,805153,809131,809603,812125,812137,812432,813001,813013,813866,814180,815972,817442,819339,819361,820110,820132,820874,820954,831850
+/tomcat/trunk:601180,606992,612607,630314,640888,652744,653247,673796,673820,677910,683969,683982,684001,684081,684234,684269-684270,685177,687503,687645,689402,690781,691392,691805,692748,693378,694992,695053,695311,696780,696782,698012,698227,698236,698613,699427,699634,701355,709294,709811,709816,710063,710066,710125,710205,711126,711600,712461,712467,718360,719119,719124,719602,719626,719628,720046,720069,721040,721286,721708,721886,723404,723738,726052,727303,728032,728768,728947,729057,729567,729569,729571,729681,729809,729815,729934,730250,730590,731651,732859,732863,734734,740675,740684,742677,742697,742714,744160,744238,746321,746384,746425,747834,747863,748344,750258,750291,750921,751286-751287,751289,751295,753039,757335,757774,758365,758596,758616,758664,759074,761601,762868,762929,762936-762937,763166,763183,763193,763228,763262,763298,763302,763325,763599,763611,763654,763681,763706,764985,764997,765662,768335,769979,770716,770809,770876,776921,776924,776935,77
 
6945,777464,777466,777576,777625,778379,778523-778524,781528,781779,782145,782791,783316,783696,783724,783756,783762,783766,783863,783934,784453,784602,784614,785381,785688,785768,785859,786468,786487,786490,786496,786667,787627,787770,787985,789389,790405,791041,791184,791194,791224,791243,791326,791328,791789,792740,793372,793757,793882,793981,794082,794673,794822,795043,795152,795210,795457,795466,797168,797425,797596,797607,802727,802940,804462,804544,804734,805153,809131,809603,810916,810977,812125,812137,812432,813001,813013,813866,814180,815972,817442,819339,819361,820110,820132,820874,820954,821397,831850

Modified: tomcat/tc6.0.x/trunk/RUNNING.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/RUNNING.txt?rev=832158&r1=832157&r2=832158&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/RUNNING.txt (original)
+++ tomcat/tc6.0.x/trunk/RUNNING.txt Mon Nov  2 22:28:35 2009
@@ -116,6 +116,11 @@
 
 * temp - Directory used by the JVM for temporary files (java.io.tmpdir)
 
+Note that by default Tomcat will first try to load classes and JARs from
+$CATALINA_BASE/lib and then $CATALINA_HOME/lib. You can place instance specific
+JARs and classes (e.g. JDBC drivers) in $CATALINA_BASE/lib whilst keeping the
+standard Tomcat JARs in $CATALINA_HOME/lib.  
+
 If you do not set $CATALINA_BASE, $CATALINA_BASE will default to the same value
 as $CATALINA_HOME, which means that the same directory is used for all relative
 path resolutions.

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=832158&r1=832157&r2=832158&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Mon Nov  2 22:28:35 2009
@@ -185,15 +185,6 @@
       }
       instead of synchronizing the entire method and hence only allowing class 
loading one class at a time
       
-
-* Allow per instance log4j.properties, JAR files (JDBC drivers) etc
-  http://svn.apache.org/viewvc?rev=810916&view=rev
-  http://svn.apache.org/viewvc?rev=810977&view=rev
-  http://svn.apache.org/viewvc?rev=821397&view=rev
-  +1: markt, kkolinko, fhanik
-  -1:
-  kkolinko: re RUNNING.txt update: it'd be better to replace "eg" with "e.g."
-
 * Allow per instance configuration of JULI or log4j for core Tomcat logging
   This requires the classpath change above
   http://svn.apache.org/viewvc?rev=810976&view=rev

Modified: tomcat/tc6.0.x/trunk/conf/catalina.properties
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/conf/catalina.properties?rev=832158&r1=832157&r2=832158&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/conf/catalina.properties (original)
+++ tomcat/tc6.0.x/trunk/conf/catalina.properties Mon Nov  2 22:28:35 2009
@@ -44,7 +44,7 @@
 #     "foo/*.jar": Add all the JARs of the specified folder as class 
 #                  repositories
 #     "foo/bar.jar": Add bar.jar as a class repository
-common.loader=${catalina.home}/lib,${catalina.home}/lib/*.jar
+common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
 
 #
 # List of comma-separated paths defining the contents of the "server" 

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/ClassLoaderFactory.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/ClassLoaderFactory.java?rev=832158&r1=832157&r2=832158&view=diff
==============================================================================
--- 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/ClassLoaderFactory.java 
(original)
+++ 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/ClassLoaderFactory.java 
Mon Nov  2 22:28:35 2009
@@ -21,7 +21,8 @@
 
 import java.io.File;
 import java.net.URL;
-import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.Set;
 
 import org.apache.catalina.loader.StandardClassLoader;
 import org.apache.juli.logging.Log;
@@ -112,7 +113,7 @@
             log.debug("Creating new class loader");
 
         // Construct the "class path" for this class loader
-        ArrayList list = new ArrayList();
+        Set<URL> set = new LinkedHashSet<URL>();
 
         // Add unpacked directories
         if (unpacked != null) {
@@ -124,7 +125,7 @@
                 URL url = file.toURI().toURL();
                 if (log.isDebugEnabled())
                     log.debug("  Including directory " + url);
-                list.add(url);
+                set.add(url);
             }
         }
 
@@ -144,13 +145,13 @@
                     if (log.isDebugEnabled())
                         log.debug("  Including jar file " + 
file.getAbsolutePath());
                     URL url = file.toURI().toURL();
-                    list.add(url);
+                    set.add(url);
                 }
             }
         }
 
         // Construct the class loader itself
-        URL[] array = (URL[]) list.toArray(new URL[list.size()]);
+        URL[] array = set.toArray(new URL[set.size()]);
         StandardClassLoader classLoader = null;
         if (parent == null)
             classLoader = new StandardClassLoader(array);
@@ -185,7 +186,7 @@
             log.debug("Creating new class loader");
 
         // Construct the "class path" for this class loader
-        ArrayList list = new ArrayList();
+        Set<URL> set = new LinkedHashSet<URL>();
 
         if (locations != null && types != null && locations.length == 
types.length) {
             for (int i = 0; i < locations.length; i++)  {
@@ -194,7 +195,7 @@
                     URL url = new URL(location);
                     if (log.isDebugEnabled())
                         log.debug("  Including URL " + url);
-                    list.add(url);
+                    set.add(url);
                 } else if ( types[i] == IS_DIR ) {
                     File directory = new File(location);
                     directory = new File(directory.getCanonicalPath());
@@ -204,7 +205,7 @@
                     URL url = directory.toURI().toURL();
                     if (log.isDebugEnabled())
                         log.debug("  Including directory " + url);
-                    list.add(url);
+                    set.add(url);
                 } else if ( types[i] == IS_JAR ) {
                     File file=new File(location);
                     file = new File(file.getCanonicalPath());
@@ -213,7 +214,7 @@
                     URL url = file.toURI().toURL();
                     if (log.isDebugEnabled())
                         log.debug("  Including jar file " + url);
-                    list.add(url);
+                    set.add(url);
                 } else if ( types[i] == IS_GLOB ) {
                     File directory=new File(location);
                     if (!directory.exists() || !directory.isDirectory() ||
@@ -235,14 +236,14 @@
                             log.debug("    Including glob jar file "
                                 + file.getAbsolutePath());
                         URL url = file.toURI().toURL();
-                        list.add(url);
+                        set.add(url);
                     }
                 }
             }
         }
 
         // Construct the class loader itself
-        URL[] array = (URL[]) list.toArray(new URL[list.size()]);
+        URL[] array = set.toArray(new URL[set.size()]);
         if (log.isDebugEnabled())
             for (int i = 0; i < array.length; i++) {
                 log.debug("  location " + i + " is " + array[i]);

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=832158&r1=832157&r2=832158&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Mon Nov  2 22:28:35 2009
@@ -424,6 +424,12 @@
         <bug>47824</bug>: Make Servlet API an optional dependency for JULI when
         using Maven. (markt)
       </fix>
+      <add>
+        Add support for per instance (using $CATALINA_BASE) log4j.properties
+        files, JDBC drivers etc by adding ${catalina.base}/lib and
+        ${catalina.base}/lib/*.jar to the start of the common loader class
+        path. (markt)
+      </add>
     </changelog>
   </subsection>
 </section>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to