tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup Bootstrap.java
Date Tue, 27 Mar 2001 01:54:20 GMT
craigmcc    01/03/26 17:54:20

  Modified:    catalina/docs/dev classloaders.html
               catalina/src/share/org/apache/catalina/startup
                        Bootstrap.java
  Log:
  Rearrange the order in which repositories are added to each of the
  standard class loader so that the "classes" directory always overrides the
  corresponding "lib/*.jar" repositories.
  
  Revision  Changes    Path
  1.6       +25 -23    jakarta-tomcat-4.0/catalina/docs/dev/classloaders.html
  
  Index: classloaders.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/docs/dev/classloaders.html,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- classloaders.html	2001/02/23 02:32:20	1.5
  +++ classloaders.html	2001/03/27 01:54:19	1.6
  @@ -79,29 +79,31 @@
           (if present on your system).</li>
       </ul>
   <li><strong>Common</strong> - This class loader is initialized to include
all 
  -    JAR files in the <code>$CATALINA_HOME/common/lib</code> directory and
  -    the <code>$CATALINA_HOME/common/classes</code> directory if it exists.
  +    unpacked classes in the <code>$CATALINA_HOME/common/classes</code>
  +    directory (if it exists), and all JAR files in the
  +    <code>$CATALINA_HOME/common/lib</code> directory (if it exists).  The
  +    latter group normally includes the following:
       <ul>
  -    <li><code>$CATALINA_HOME/common/lib/servlet.jar</code> - The servlet
and
  -        JSP API classes.</li>
  -    <li><code>$CATALIA_HOME/common/lib/naming.jar</code> - The JNDI
  -	implementation used by Tomcat 4, added only if you are running
  -	in a JDK 1.2 environment (the JNDI classes are included in JDK
  -	1.3 or later).</li>
  -    </ul>
  -<li><strong>Catalina</strong> - This class loader is initialized to include
  -    all JAR files in the <code>$CATALINA_HOME/server</code> directory, which
  -    should contain Catalina itself (i.e. all classes whose fully qualified
  -    names begin with <code>org.apache.catalina.</code>), and any JAR files
  -    that it depends on and the <code>$CATALINA_HOME/server/classes</code>
  -    directory if it exists.  Because these classes are loaded from a separate
  -    class loader, which is not visible to the <strong>Webapp</strong> class
  -    loader, they are <em>not</em> visible to web applications.</li>
  -<li><strong>Shared</strong> - This class loader is initialized to include
  -    all JAR files in the <code>$CATALINA_HOME/lib</code> directory and the
  -    <code>$CATALINA_HOME/classes</code> directory if it exists.  All of
  -    the classes in these repositories will be visible to all web applications,
  -    so they may be used to share information between web apps
  +    <li><code>jndi.jar</code> - The Java Naming and Directory Service
API
  +        classes (loaded <strong>only</strong> if not already included in
  +        the JDK, as they are with JDK 1.3).</li>
  +    <li><code>naming.jar</code> - The JNDI implementation used by
  +        Tomcat 4 itself.</li>
  +    <li><code>servlet.jar</code> - The servlet and JSP API classes.</li>
  +    </ul></li>
  +<li><strong>Catalina</strong> - This class loader is initialized to include
all
  +    unpacked classes in the <code>$CATALINA_HOME/server/classes</code>
  +    directory (if it exists), and all JAR files in the
  +    <code>$CATALINA_HOME/server/lib</code> directory (if it exists).  Because
  +    these classes are loaded from a separate class loader, which is not visible
  +    to the <strong>Webapp</strong> class loader, they are <em>not</em>
visible
  +    to web applications.</li>
  +<li><strong>Shared</strong> - This class loader is initialized to include
all
  +    unpacked classes in the <code>$CATALINA_HOME/classes</code> directory
  +    (if it exists), and all JAR files in the <code>$CATALINA_HOME/lib</code>
  +    directory (if it exists).  All of the classes in these repositories will
  +    be visible to all web applications, so they may be used to share
  +    information between web apps.
       (<strong>NOTE</strong> - this behavior is specific to Tomcat 4.0, and
       will not necessarily be portable to other containers.)</li>
   <li><strong>WebappX</strong> - A class loader is created for each web
  @@ -249,7 +251,7 @@
   
   <br>
   <div align="center"><hr width="75%"><font size="2">
  -$Id: classloaders.html,v 1.5 2001/02/23 02:32:20 glenn Exp $
  +$Id: classloaders.html,v 1.6 2001/03/27 01:54:19 craigmcc Exp $
   </font></div>
   
   </body>
  
  
  
  1.14      +64 -58    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java
  
  Index: Bootstrap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Bootstrap.java	2001/03/06 01:42:55	1.13
  +++ Bootstrap.java	2001/03/27 01:54:20	1.14
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v
1.13 2001/03/06 01:42:55 glenn Exp $
  - * $Revision: 1.13 $
  - * $Date: 2001/03/06 01:42:55 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v
1.14 2001/03/27 01:54:20 craigmcc Exp $
  + * $Revision: 1.14 $
  + * $Date: 2001/03/27 01:54:20 $
    *
    * ====================================================================
    *
  @@ -85,7 +85,7 @@
    * class path and therefore not visible to application level classes.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.13 $ $Date: 2001/03/06 01:42:55 $
  + * @version $Revision: 1.14 $ $Date: 2001/03/27 01:54:20 $
    */
   
   public final class Bootstrap {
  @@ -207,6 +207,26 @@
           // Construct the "class path" for this class loader
           ArrayList list = new ArrayList();
   
  +        // Add the "common/classes" directory if it exists
  +        File classes = new File(System.getProperty("catalina.home"),
  +                                "common/classes");
  +        if (classes.exists() && classes.canRead() &&
  +            classes.isDirectory()) {
  +            try {
  +                URL url = new URL("file", null,
  +                                  classes.getCanonicalPath() + "/");
  +                if (debug >= 1)
  +                    log("  Adding " + url.toString());
  +                list.add(url.toString());
  +            } catch (IOException e) {
  +                System.out.println("Cannot create URL for " +
  +                                   classes.getAbsolutePath());
  +                e.printStackTrace(System.out);
  +                System.exit(1);
  +            }
  +        }
  +
  +        // Add all JAR files in the "common/lib" directory if it exists
           File directory = new File(System.getProperty("catalina.home"),
                                     "common/lib");
           if (!directory.exists() || !directory.canRead() ||
  @@ -236,24 +256,6 @@
               }
           }
   
  -        File classes = new File(System.getProperty("catalina.home"),
  -                                "common/classes");
  -        if (classes.exists() && classes.canRead() &&
  -            classes.isDirectory()) {
  -            try {
  -                URL url = new URL("file", null,
  -                                  classes.getCanonicalPath() + "/");
  -                if (debug >= 1)
  -                    log("  Adding " + url.toString());
  -                list.add(url.toString());
  -            } catch (IOException e) {
  -                System.out.println("Cannot create URL for " +
  -                                   classes.getAbsolutePath());
  -                e.printStackTrace(System.out);
  -                System.exit(1);
  -            }
  -        }
  -
           // Construct the class loader itself
           String array[] = (String[]) list.toArray(new String[list.size()]);
           StandardClassLoader loader = new StandardClassLoader(array);
  @@ -275,6 +277,26 @@
           // Construct the "class path" for this class loader
           ArrayList list = new ArrayList();
   
  +        // Add the "server/classes" directory if it exists
  +        File classes = new File(System.getProperty("catalina.home"),
  +                                "server/classes");                  
  +        if (classes.exists() && classes.canRead() &&                
  +            classes.isDirectory()) {                
  +            try {                                   
  +                URL url = new URL("file", null,
  +                                  classes.getCanonicalPath() + "/");
  +                if (debug >= 1)
  +                    log("  Adding " + url.toString());
  +                list.add(url.toString());
  +            } catch (IOException e) {
  +                System.out.println("Cannot create URL for " +
  +                                   classes.getAbsolutePath());
  +                e.printStackTrace(System.out);
  +                System.exit(1);
  +            }   
  +        }
  +
  +        // Add all JAR files in the "server/lib" directory if it exists
           File directory = new File(System.getProperty("catalina.home"),
                                     "server/lib");
           if (!directory.exists() || !directory.canRead() ||
  @@ -301,24 +323,6 @@
               }
   	}
   
  -        File classes = new File(System.getProperty("catalina.home"),
  -                                "server/classes");                  
  -        if (classes.exists() && classes.canRead() &&                
  -            classes.isDirectory()) {                
  -            try {                                   
  -                URL url = new URL("file", null,
  -                                  classes.getCanonicalPath() + "/");
  -                if (debug >= 1)
  -                    log("  Adding " + url.toString());
  -                list.add(url.toString());
  -            } catch (IOException e) {
  -                System.out.println("Cannot create URL for " +
  -                                   classes.getAbsolutePath());
  -                e.printStackTrace(System.out);
  -                System.exit(1);
  -            }   
  -        }
  -
           // Construct the class loader itself
           String array[] = (String[]) list.toArray(new String[list.size()]);
           StandardClassLoader loader = new StandardClassLoader(array, parent);
  @@ -340,6 +344,26 @@
           // Construct the "class path" for this class loader
           ArrayList list = new ArrayList();
   
  +        // Add the "classes" directory if it exists
  +        File classes = new File(System.getProperty("catalina.home"),
  +                                "classes");                         
  +        if (classes.exists() && classes.canRead() &&                
  +            classes.isDirectory()) {                
  +            try {                                   
  +                URL url = new URL("file", null,
  +                                  classes.getCanonicalPath() + "/");
  +                if (debug >= 1)                                     
  +                    log("  Adding " + url.toString());              
  +                list.add(url.toString());             
  +            } catch (IOException e) {                 
  +                System.out.println("Cannot create URL for " +
  +                                   classes.getAbsolutePath());
  +                e.printStackTrace(System.out);                
  +                System.exit(1);                               
  +            }                                 
  +        }
  +
  +        // Add all JAR files in the "lib" directory if it exists
           File directory = new File(System.getProperty("catalina.home"),
                                     "lib");
           if (!directory.exists() || !directory.canRead() ||
  @@ -365,24 +389,6 @@
                   System.exit(1);
               }
   	}
  -
  -        File classes = new File(System.getProperty("catalina.home"),
  -                                "classes");                         
  -        if (classes.exists() && classes.canRead() &&                
  -            classes.isDirectory()) {                
  -            try {                                   
  -                URL url = new URL("file", null,
  -                                  classes.getCanonicalPath() + "/");
  -                if (debug >= 1)                                     
  -                    log("  Adding " + url.toString());              
  -                list.add(url.toString());             
  -            } catch (IOException e) {                 
  -                System.out.println("Cannot create URL for " +
  -                                   classes.getAbsolutePath());
  -                e.printStackTrace(System.out);                
  -                System.exit(1);                               
  -            }                                 
  -        }
   
           // Construct the class loader itself
           String array[] = (String[]) list.toArray(new String[list.size()]);
  
  
  

Mime
View raw message