Return-Path: Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 70344 invoked by uid 500); 20 Jan 2001 21:40:48 -0000 Delivered-To: apmail-jakarta-tomcat-cvs@apache.org Received: (qmail 70341 invoked by uid 1052); 20 Jan 2001 21:40:48 -0000 Date: 20 Jan 2001 21:40:48 -0000 Message-ID: <20010120214048.70340.qmail@apache.org> From: costin@apache.org To: jakarta-tomcat-cvs@apache.org Subject: cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config DefaultCMSetter.java ServerXmlInterceptor.java costin 01/01/20 13:40:47 Modified: src/share/org/apache/tomcat/modules/config DefaultCMSetter.java ServerXmlInterceptor.java Log: Few minor changes/fixes ( done long ago ) to better guess tomcat.home ( useful if you embed tomcat or use "java -jar" style of startup ). ( everything is fine if TOMCAT.HOME is set or PWD is TOMCAT.HOME, but this is not allways the case - that's what we fix here. ) IntrospectionUtil looks in the classpath ( assuming jars are not moved around too much ) and finds the location of tomcat_core.jar, and sets tomcat home based on that. It's the equivalent of the .sh script. This is needed on Windows if executable jars are supported. There is more testing to be done. Revision Changes Path 1.4 +9 -3 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/DefaultCMSetter.java Index: DefaultCMSetter.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/DefaultCMSetter.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- DefaultCMSetter.java 2001/01/01 03:42:58 1.3 +++ DefaultCMSetter.java 2001/01/20 21:40:47 1.4 @@ -84,7 +84,6 @@ } /** Adjust context manager paths. - * FIRST */ public void engineInit( ContextManager cm ) throws TomcatException @@ -113,11 +112,15 @@ // if only one is set home==installDir - if( home!=null && installDir == null ) + if( home!=null && installDir == null ) { cm.setInstallDir( home ); + installDir=home; + } - if( home==null && installDir != null ) + if( home==null && installDir != null ) { cm.setHome( installDir ); + home=installDir; + } // if neither home or install is set, // and no system property, try "." @@ -142,6 +145,9 @@ } cm.setWorkDir( workDir ); initLoggers(cm.getLoggers()); + + if(debug>1) log( "Setting: " + installDir + " " + + home + " " + workDir); } /** Generate a random number 1.5 +3 -2 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ServerXmlInterceptor.java Index: ServerXmlInterceptor.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ServerXmlInterceptor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ServerXmlInterceptor.java 2000/12/29 21:24:33 1.4 +++ ServerXmlInterceptor.java 2001/01/20 21:40:47 1.5 @@ -322,8 +322,9 @@ * @param cm The ContextManager we are configuring **/ public String getTomcatInstall() { - // Use the "tomcat.home" property to resolve the default filename - String tchome = System.getProperty("tomcat.home"); + String tchome=IntrospectionUtils.guessHome( "tomcat.home", + "tomcat_core.jar", + "org/apache/tomcat/core/Request.class"); if (tchome == null) { System.out.println(sm.getString("tomcat.nohome")); tchome = ".";