You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@apache.org on 2001/09/11 22:28:41 UTC

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup Embedded.java

craigmcc    01/09/11 13:28:41

  Modified:    catalina/src/share/org/apache/catalina/startup Embedded.java
  Log:
  Modify the org.apache.catalina.startup.Embedded class to *require* that
  the "catalina.home" system property be set in order to function.  Many
  internal Catalina operations depend on this.
  
  Modify the org.apache.catalina.startup.Embedded class to copy the value of
  the "catalina.home" system property to the "catalina.base" system property
  if the latter is not set.  Many internal Catalina operations depend on
  this.
  
  Add a backwards-compatibility patch so that the most recent Tomcat 4.0
  code will still run with the J2EE 1.3 Reference Implementation.
  
  Revision  Changes    Path
  1.11      +29 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Embedded.java
  
  Index: Embedded.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Embedded.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Embedded.java	2001/07/24 22:48:31	1.10
  +++ Embedded.java	2001/09/11 20:28:41	1.11
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Embedded.java,v 1.10 2001/07/24 22:48:31 pier Exp $
  - * $Revision: 1.10 $
  - * $Date: 2001/07/24 22:48:31 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Embedded.java,v 1.11 2001/09/11 20:28:41 craigmcc Exp $
  + * $Revision: 1.11 $
  + * $Date: 2001/09/11 20:28:41 $
    *
    * ====================================================================
    *
  @@ -148,7 +148,7 @@
    * </pre>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.10 $ $Date: 2001/07/24 22:48:31 $
  + * @version $Revision: 1.11 $ $Date: 2001/09/11 20:28:41 $
    */
   
   public class Embedded implements Lifecycle {
  @@ -911,6 +911,22 @@
           if (debug >= 1)
               logger.log("Starting embedded server");
   
  +        // Validate the setup of our required system properties
  +        if (System.getProperty("catalina.home") == null) {
  +            // Backwards compatibility patch for J2EE RI 1.3
  +            String j2eeHome = System.getProperty("com.sun.enterprise.home");
  +            if (j2eeHome != null)
  +                System.setProperty
  +                    ("catalina.home",
  +                     System.getProperty("com.sun.enterprise.home"));
  +            else
  +                throw new LifecycleException
  +                    ("Must set 'catalina.home' system property");
  +        }
  +        if (System.getProperty("catalina.base") == null)
  +            System.setProperty("catalina.base",
  +                               System.getProperty("catalina.home"));
  +
           // Validate and update our current component state
           if (started)
               throw new LifecycleException
  @@ -1009,6 +1025,15 @@
           embedded.setDebug(5);
           embedded.setLogger(new SystemOutLogger());
           String home = System.getProperty("catalina.home");
  +        if (home == null) {
  +            System.err.println("You must set the 'catalina.home' system property");
  +            System.exit(1);
  +        }
  +        String base = System.getProperty("catalina.base");
  +        if (base == null) {
  +            base = home;
  +            System.setProperty("catalina.base", base);
  +        }
   
           // Start up this embedded server (to prove we can dynamically
           // add and remove containers and connectors later)