tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/startup Tomcat.java
Date Sat, 25 Mar 2000 03:35:29 GMT
costin      00/03/24 19:35:28

  Modified:    .        build.xml
               etc      in-process-howto.html tomcat-iis-howto.html
                        tomcat-netscape-howto.html
               src/share/org/apache/tomcat/context AutoSetup.java
                        DefaultCMSetter.java
               src/share/org/apache/tomcat/core ContextManager.java
               src/share/org/apache/tomcat/logging Logger.java
               src/share/org/apache/tomcat/service JNIEndpoint.java
               src/share/org/apache/tomcat/startup Tomcat.java
  Added:       src/etc  jni_server.xml jni_workers.properties obj.conf
                        uriworkermap.properties workers.properties
  Removed:     etc      jni_server.xml jni_workers.properties obj.conf
                        uriworkermap.properties workers.properties
  Log:
  Verified tomcat on Win98 working standalone, with IIS with AJP and JNI
  connectors. Terific job Gal, the JNI is just great.
  
  Fixed minor problems with directories - make sure the loggers are created
  under tomcat home, same for workdir.
  
  Added few more comments and few more checks - Tomcat+JNI+IIS is a very good
  test case, no control on start dir or env.
  Also made few changes in the IIS, Netsape and JNI documentations and moved
  the sample config files into src/etc - it will now be built into tomcat.
  
  The current behavior is a bit more permisive with config problems:
  
  - if -Dtomcat.home is set, it will be used as tomcat installation dir, and
  will be used for classpath and default files ( dtds, configs ).
  If <contextManager home=""> is specified it will be used as base for webapps,
  config, logs, workdir.
  
  - if no tomcat.home is set, we use  contextManager.home as default - it is
  also possible to set tomcatHome as an attribute of <contextManager>
  
  - if none is set up, current working directory is used.( we should throw
  an exception probably, but give it a chance)
  
  Revision  Changes    Path
  1.40      +4 -1      jakarta-tomcat/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/build.xml,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- build.xml	2000/02/29 14:38:12	1.39
  +++ build.xml	2000/03/25 03:35:21	1.40
  @@ -25,7 +25,10 @@
       <copydir src="src/shell" dest="${tomcat.build}/bin" />
       <copydir src="src/etc" dest="${tomcat.build}/conf"/>
       <copydir src="src/doc" dest="${tomcat.build}/doc"/>
  -    <copydir src="src/share/javax" dest="${tomcat.build}/src/javax"/>
  +    <copydir src="src/share/javax" dest="${tomcat.home}/src/javax"/>
  +    <copydir src="src/share/org" dest="${tomcat.home}/src/org"/>
  +
  +    <copyfile src="build.xml" dest="${tomcat.build}/conf/build.xml"/>
       <mkdir dir="${tomcat.build}/lib/test"/>
       <mkdir dir="${tomcat.build}/lib/test/Golden"/>
       <copydir src="src/tests/share/tests/jsp/Golden" dest="${tomcat.build}/lib/test/Golden"/>
  
  
  
  1.3       +3 -4      jakarta-tomcat/etc/in-process-howto.html
  
  Index: in-process-howto.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/etc/in-process-howto.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- in-process-howto.html	2000/03/14 15:14:38	1.2
  +++ in-process-howto.html	2000/03/25 03:35:22	1.3
  @@ -129,8 +129,7 @@
     <tt>worker.jni.ld_path=d:\my\native\code</tt>
     </li>
   </ol>
  -You can find a sample worker file (<tt>jni_workers.properties</tt>) in the
  -CVS under <tt>jakarta-tomcat/etc</tt>.
  +You can find a sample worker file (<tt>jni_workers.properties</tt>)  under
<tt>tomcat/conf</tt>. 
   
   <h3>Update server.xml</h3>
   <p>
  @@ -166,9 +165,9 @@
     <tt>"/examples"</tt> and <tt>"/test"</tt>, you will have to fix
their
     docBase too (as demonstrated above).
     </li>
  +  <li>Make sure you set the home attribute to point to tomcat home.</li>
   </ol>
  -You can find a sample server file (<tt>jni_servre.xml</tt>) in the
  -CVS under <tt>jakarta-tomcat/etc</tt>.
  +You can find a sample server file (<tt>jni_server.xml</tt>) under <tt>jakarta-tomcat/conf</tt>.
   
   <h3>Redirect contexts to the JNI workers</h3>
   <p>You will need to select the contexts that you wish to serve using your
  
  
  
  1.6       +12 -4     jakarta-tomcat/etc/tomcat-iis-howto.html
  
  Index: tomcat-iis-howto.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/etc/tomcat-iis-howto.html,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- tomcat-iis-howto.html	2000/03/19 12:30:43	1.5
  +++ tomcat-iis-howto.html	2000/03/25 03:35:23	1.6
  @@ -60,10 +60,10 @@
     DLL or build it yourself (see the build section).</li>
     <li>workers.properties - A file that describes the host(s) and port(s) used
     by the workers (Tomcat processes). A sample <tt>workers.properties</tt> can
  -  be found in the CVS under <tt>jakarta-tomcat/etc</tt>. </li>
  +  be found under <tt>tomcat/conf</tt>. </li>
     <li>uriworkermap.properties - A file that maps URL-Path patterns to
     workers. A sample <tt>uriworkermap.properties</tt> can be found in the CVS
  -  under <tt>jakarta-tomcat/etc</tt>. </li>
  +  under <tt>tomcat/conf</tt>. </li>
   </ol>
   
   <p>The installation includes the following parts:
  @@ -106,9 +106,17 @@
     <li>Using the IIS management console, add isapi_redirect.dll as a filter
       in your IIS/PWS web site. The name of the filter should reflect its task
   	(I use the name jakarta), its executable must be our
  -	<tt>d:\tomcat\bin\iis\i386\isapi_redirect.dll</tt>.</li>
  +	<tt>d:\tomcat\bin\iis\i386\isapi_redirect.dll</tt>. For PWS, you'll need 
  +	to use regedit and add/edit the "Filter DLLs" key under 
  +	HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\W3SVC\Parameters. This key 
  +        contains a "," separated list of dlls ( full paths ) - you need to insert the 
  +        full path to isapi_redirect.dll.</li>
     <li>Restart IIS (stop + start the IIS admin server), make sure that the
  -    jakarta filter is marked with a green up-pointing arrow.</li>
  +    jakarta filter is marked with a green up-pointing arrow. <br>(costin)Under Win98
you may 
  +    need to cd WINDOWS\SYSTEM\inetsrv and type PWS /stop ( the DLL and log files are locked
-
  +    even if you click the stop button, PWS will still keep the DLLs in memory. ). Type
pws
  +    to start it again.
  + </li>
   </ol>
   
   <p>That's all, you should now start tomcat and ask IIS to serve you the /examples
context.</p>
  
  
  
  1.5       +2 -3      jakarta-tomcat/etc/tomcat-netscape-howto.html
  
  Index: tomcat-netscape-howto.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/etc/tomcat-netscape-howto.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- tomcat-netscape-howto.html	2000/03/19 12:30:43	1.4
  +++ tomcat-netscape-howto.html	2000/03/25 03:35:23	1.5
  @@ -59,9 +59,8 @@
     <li>nsapi_redirect.dll - The Netscape server plugin, either obtain a
      pre-built DLL or build it yourself (see the build section).</li>
     <li>workers.properties - A file that describes the host(s) and port(s)
  -   used by the workers (Tomcat processes). You should copy this file from
  -   the CVS (<tt>jakarta-tomcat/etc/workers.properties</tt>) and place it in
  -   your conf directory.</li>
  +   used by the workers (Tomcat processes). This file is located 
  +   in (<tt>tomcat/conf/workers.properties</tt>).</li>
   </ol>
   
   <p>The installation includes the following parts:
  
  
  
  1.1                  jakarta-tomcat/src/etc/jni_server.xml
  
  Index: jni_server.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <Server>
      <ContextManager port="8080" hostName="" inet="">
  
          <!--
  		     JNI connector, make sure that you update the native_lib
               Parameter to point to your jni_connect.dll
  		 -->
          <Connector className="org.apache.tomcat.service.JNIEndpointConnector">
              <Parameter name="native_lib" value="D:\tomcat\bin\jni_connect\nt4\i386\jni_connect.dll"/>
          </Connector>
  
          <!--
              Setting the contexts explicitly
  		 -->
          <Context path="/" docBase="D:\tomcat\webapps\ROOT" />
          <Context path="/examples" docBase="D:\tomcat\webapps\examples" />
          <Context path="/test" docBase="D:\tomcat\webapps\test" />
  
      </ContextManager>
  </Server>
  
  
  
  1.1                  jakarta-tomcat/src/etc/jni_workers.properties
  
  Index: jni_workers.properties
  ===================================================================
  
  #
  # Sample worker configuration file with a jni worker
  #
  # You will probably need to update your tomcat
  # root directory and JVM library path
  #
  # You should begin by replacing any occurrence of d:\tomcat with
  # your own tomcat root. Following that replace path starting with
  # d:\sdk\jdk1.2.2\ with your own java home.
  #
  worker.list=jni
  
  worker.jni.type=jni
  
  #
  # Additional class path components.
  #
  worker.jni.class_path=d:\tomcat\tomcat\classes
  worker.jni.class_path=d:\tomcat\tomcat\lib\xml.jar
  worker.jni.class_path=d:\tomcat\tomcat\lib\jasper.jar
  worker.jni.class_path=d:\tomcat\tomcat\lib\servlet.jar
  worker.jni.class_path=d:\tomcat\tomcat\lib\webserver.jar
  worker.jni.class_path=d:\sdk\jdk1.2.2\lib\tools.jar
  # worker.jni.class_path=d:\SQLLIB\java\db2java.zip
  
  #
  # Setting the command line for tomcat
  #
  worker.jni.cmd_line=-config
  worker.jni.cmd_line=d:\tomcat\conf\jni_server.xml
  
  #
  # The JVM that we are about to use
  #
  # This is for jdk1.2.x
  #
  worker.jni.jvm_lib=d:\sdk\jdk1.2.2\jre\bin\classic\jvm.dll
  #
  # And this is for jdk1.1.7
  #
  #worker.jni.jvm_lib=d:\sdk\jdk1.1.7\bin\javai.dll
  #
  
  #
  # Setting the place for the stdout and stderr of tomcat
  #
  worker.jni.stdout=d:\tomcat\jvm.stdout
  worker.jni.stderr=d:\tomcat\jvm.stderr
  
  #
  # Java system properties
  #
  # worker.jni.sysprops=java.compiler=NONE
  # worker.jni.sysprops=myprop=mypropvalue
  
  #
  # Additional path components.
  #
  # worker.jni.ld_path=d:\SQLLIB\bin
  #
  
  
  
  
  
  1.1                  jakarta-tomcat/src/etc/obj.conf
  
  Index: obj.conf
  ===================================================================
  
  Init fn=flex-init access="d:/web-servers/ent3.6/https-ps139-16/logs/access" format.access="%Ses->client.ip%
- %Req->vars.auth-user% [%SYSDATE%] \"%Req->reqpb.clf-request%\" %Req->srvhdrs.clf-status%
%Req->srvhdrs.content-length%"
  Init fn=load-types mime-types=mime.types
  
  #
  # Initializing the redirector
  #
  Init fn="load-modules" funcs="jk_init,jk_service" shlib="d:/tomcat/bin/netscape/nt4/i386/nsapi_redirect.dll"
  Init fn="jk_init" worker_file="d:/tomcat/conf/workers.properties" log_level="debug" log_file="d:/tomcat/nsapi.log"
  
  <Object name=default>
  #
  # Assign contexts to Tomcat
  #
  NameTrans fn="assign-name" from="/servlet/*" name="servlet"
  NameTrans fn="assign-name" from="/examples/*" name="servlet"
  #
  # Advanced context configuration
  #
  # NameTrans fn="assign-name" from="/examples/jsp/*.jsp" name="servlet"
  # NameTrans fn="assign-name" from="/examples/servlet/*" name="servlet"
  # NameTrans fn=pfx2dir from=/examples dir="d:/tomcat/examples"
  
  NameTrans fn=pfx2dir from=/ns-icons dir="d:/web-servers/ent3.6/ns-icons"
  NameTrans fn=pfx2dir from=/mc-icons dir="d:/web-servers/ent3.6/ns-icons"
  NameTrans fn="pfx2dir" from="/help" dir="d:/web-servers/ent3.6/manual/https/ug"
  NameTrans fn=document-root root="d:/web-servers/ent3.6/docs"
  
  #
  # Advanced context configuration
  #
  # PathCheck fn="deny-existence" path="*/WEB-INF/*"
  
  PathCheck fn=nt-uri-clean
  PathCheck fn="check-acl" acl="default"
  PathCheck fn=find-pathinfo
  PathCheck fn=find-index index-names="index.jsp,index.html,home.html"
  ObjectType fn=type-by-extension
  ObjectType fn=force-type type=text/plain
  Service method=(GET|HEAD) type=magnus-internal/imagemap fn=imagemap
  Service method=(GET|HEAD) type=magnus-internal/directory fn=index-common
  Service method=(GET|HEAD) type=*~magnus-internal/* fn=send-file
  AddLog fn=flex-log name="access"
  </Object>
  
  <Object name=cgi>
  ObjectType fn=force-type type=magnus-internal/cgi
  Service fn=send-cgi
  </Object>
  
  <Object name=servlet>
  #
  # Pass the request to the ajp12 worker
  #
  ObjectType fn=force-type type=text/plain
  Service fn="jk_service" worker="ajp12"
  
  #
  # Pass the request to the jni worker
  #
  # Service fn="jk_service" worker="ajp12"
  #
  </Object>
  
  
  
  
  1.1                  jakarta-tomcat/src/etc/uriworkermap.properties
  
  Index: uriworkermap.properties
  ===================================================================
  
  #
  # Simple worker configuration file
  #
  
  # Mount the servlet context to the ajp12 worker
  /servlet/*=ajp12
  
  # Mount the examples context to the ajp12 worker
  /examples/*=ajp12
  
  # Advanced mount of the examples context
  # /examples/*.jsp=ajp12
  # /examples/servlet/*=ajp12
  
  
  
  1.1                  jakarta-tomcat/src/etc/workers.properties
  
  Index: workers.properties
  ===================================================================
  
  #
  # Simple worker configuration file
  #
  
  worker.list=ajp12
  
  worker.ajp12.port=8007
  worker.ajp12.host=localhost
  
  #
  # Two workers definition
  #
  # worker.list=ajp12, ajp12second
  #
  #
  # worker.ajp12second.host=otherhost
  # worker.ajp12second.port=8007
  # 
  # worker.ajp12.host=localhost
  # worker.ajp12.port=8007
  
  
  
  1.9       +8 -3      jakarta-tomcat/src/share/org/apache/tomcat/context/AutoSetup.java
  
  Index: AutoSetup.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/AutoSetup.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AutoSetup.java	2000/03/16 20:43:22	1.8
  +++ AutoSetup.java	2000/03/25 03:35:25	1.9
  @@ -87,10 +87,15 @@
       public void engineInit(ContextManager cm) throws TomcatException {
   	String home=cm.getHome();
   	File webappD=new File(home + "/webapps");
  -	if (! webappD.exists() || ! webappD.isDirectory())
  +	if (! webappD.exists() || ! webappD.isDirectory()) {
  +	    System.out.println("No webapps/ directory " + webappD );
   	    return ; // nothing to set up
  -
  +	}
  +	
   	String[] list = webappD.list();
  +	if( list.length==0 ) {
  +	    System.out.println("No apps in webapps/ ");
  +	}
   	for (int i = 0; i < list.length; i++) {
   	    String name = list[i];
   	    if( name.endsWith(".war") ) {
  @@ -139,7 +144,7 @@
   		// don't assume HOME==TOMCAT_HOME
   		File f=new File( webappD, name);
   		ctx.setDocBase( f.getAbsolutePath() );
  -		if( debug > 0) ctx.log("<l:autoLoadContext docBase=\"" + ctx.getDocBase() + "\"
/>");
  +		ctx.log("<l:autoLoadContext docBase=\"" + ctx.getDocBase() + "\" />");
   		cm.addContext(ctx);
   	    } else {
   		//System.out.println("Already set up: " + path + " " + cm.getContext(path));
  
  
  
  1.27      +41 -1     jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java
  
  Index: DefaultCMSetter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- DefaultCMSetter.java	2000/03/23 23:34:35	1.26
  +++ DefaultCMSetter.java	2000/03/25 03:35:25	1.27
  @@ -82,11 +82,51 @@
       }
   
       public void engineInit(ContextManager cm) throws TomcatException {
  -	// check if we have the right tomcat home directory
  +	File homeF=new File( cm.getHome());
  +
  +	// Setup loggers - they may have relative paths.
  +	Enumeration enum=Logger.getLoggerNames();
  +	while( enum.hasMoreElements() ) {
  +	    String loggerN=(String)enum.nextElement();
  +	    Logger l=Logger.getLogger( loggerN );
  +	    String path=l.getPath();
  +	    if( path!=null ) {
  +		File f=new File( path );
  +		if( ! f.isAbsolute() ) {
  +		    // Make it relative to home !
  +		    File wd=new File(homeF , path );
  +		    l.setPath( wd.getAbsolutePath() );
  +		}
  +		// create the files, ready to log.
  +	    } 
  +	    l.open();
  +	}
  +
  +	// check if we have the right tomcat.home directory
  +	// Tomcat.home is needed in several places - it keeps .dtd and default
  +	// config files, etc - if it's not set probably something is wrong.
  +	//
  +	// It defaults to the home attribute - this is the common case anyway.
  +	//
  +	// XXX document all uses of tomcat.home
  +	// ( as a rule: cm.getHome() is used to access all files, but if a file is not
  +	// found, cm.getTomcatHome() is used)
  +	// ( getHome returns the "instance" of tomcat, it may have it's own log, work, webapps,
  +	//   getTomcatHome is where tomcat is installed )
  +	//  Note: home defaults to tomcat.home if none is set...
   	File f=new File( cm.getTomcatHome() + "/conf/web.xml");
   	if( ! f.exists() ) {
   	    throw new TomcatException( "Wrong tomcat home " + cm.getHome());
   	}
  +	// update the workdir
  +	String workDir=cm.getWorkDir();
  +	f=new File( workDir );
  +	if( ! f.isAbsolute() ) {
  +	    // Make it relative to home !
  +	    File wd=new File(homeF , workDir );
  +	    cm.setWorkDir( wd.getAbsolutePath() );
  +	}
  +
       }
       
       /** Called when a new context is added to the server.
  
  
  
  1.64      +35 -20    jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java
  
  Index: ContextManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- ContextManager.java	2000/03/21 19:19:40	1.63
  +++ ContextManager.java	2000/03/25 03:35:26	1.64
  @@ -124,6 +124,7 @@
   
       // Instalation directory  
       String home;
  +    String tomcatHome;
       
       Vector connectors=new Vector();
   
  @@ -184,7 +185,7 @@
        */
       public void init()  throws TomcatException {
   	String cp=System.getProperty( "java.class.path");
  -	log( "<l:tomcat home=\"" + home + "\" classPath=\"" + cp + "\" />");
  +	log( "<l:tomcat install=\"" + tomcatHome + "\" home=\"" + home + "\" classPath=\""
+ cp + "\" />");
   	//	long time=System.currentTimeMillis();
   	ContextInterceptor cI[]=getContextInterceptors();
   	for( int i=0; i< cI.length; i++ ) {
  @@ -424,20 +425,46 @@
   	if(home!=null) return home;
   
   	// If none defined, assume tomcat.home is used as base.
  -	String homeS=System.getProperty("tomcat.home");
  -	if( homeS != null )
  -	    setHome( homeS );
  -	else
  -	    setHome("."); // try current dir - we should throw an exception
  +	home=getCanonicalPath( tomcatHome );
  +	if(home!=null) return home;
  +
  +	// try at least the system property
  +	home=getCanonicalPath( System.getProperty("tomcat.home") );	
  +	if(home!=null) return home;
  +	
  +	home=getCanonicalPath( "." ); // try current dir - we should throw an exception
   	return home;
       }
       
       /** Tomcat installation directory, where libraries and default files are located
        */
       public String getTomcatHome() {
  -	return System.getProperty("tomcat.home");
  +	if(tomcatHome!= null) return tomcatHome;
  +	
  +	tomcatHome=System.getProperty("tomcat.home");
  +	if(tomcatHome!= null) return tomcatHome;
  +
  +	// If the property is not set ( for example JNI worker ) assume
  +	// at least home is set up corectly.
  +	tomcatHome=getHome();
  +	return tomcatHome;
  +    }
  +
  +    public void setTomcatHome( String tH ) {
  +	tomcatHome=tH;
       }
   
  +    // Used in few places.
  +    static String getCanonicalPath(String name ) {
  +	if( name==null ) return null;
  +        File f = new File(name);
  +        try {
  +            return  f.getCanonicalPath();
  +        } catch (IOException ioe) {
  +             return name; // oh well, we tried...
  +        }
  +    }
  +    
       /** 
        * Set installation directory.  If path specified is relative, 
        * evaluate it relative to the current working directory.
  @@ -447,19 +474,7 @@
        * not affect that.
        */
       public void setHome(String home) {
  -        File homeFile = new File(home);
  -
  -	// change it if you want relative home based on tomcat.home
  -	//         if (!homeFile.isAbsolute()) {
  -	//             String tomcat_home = System.getProperty("tomcat.home");
  -	//             if (tomcat_home != null) homeFile = new File(tomcat_home, home); 
  -	//         }
  -        
  -        try {
  -            this.home = homeFile.getCanonicalPath();
  -        } catch (IOException ioe) {
  -            this.home = home; // oh well, we tried...
  -        }
  +	home=getCanonicalPath( home ); 
   	log( "Setting home to " + this.home );
       }
       
  
  
  
  1.5       +21 -3     jakarta-tomcat/src/share/org/apache/tomcat/logging/Logger.java
  
  Index: Logger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/logging/Logger.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Logger.java	2000/02/22 21:06:40	1.4
  +++ Logger.java	2000/03/25 03:35:27	1.5
  @@ -62,7 +62,7 @@
   import java.io.File;
   import java.io.IOException;
   
  -import java.util.Hashtable;
  +import java.util.*;
   
   /**
    * Interface for a logging object. A logging object provides mechanism
  @@ -211,12 +211,25 @@
        * @param	path		The path to the log file. 
        */
       public void setPath(String path) {
  +	this.path=path;
  +    }
  +
  +    public String getPath() {
  +	return path;
  +    }
  +
  +    /** Open the log - will create the log file and all the parent directories.
  +     *  You must open the logger before use, or it will write to System.err
  +     */
  +    public void open() {
  +	if( path==null ) return;
  +	// use default sink == System.err
   	try {
   	    File file = new File(path);
  -
  +	    
   	    if (!file.exists())
   		new File(file.getParent()).mkdirs();
  -		
  +	    
   	    this.sink = new FileWriter(path);
   	} catch (IOException ex) {
   	    System.err.print("Unable to open log file: "+path+"! ");
  @@ -301,6 +314,10 @@
   	return (Logger) loggers.get(name);
       }
   
  +    public static Enumeration getLoggerNames() {
  +	return loggers.keys();
  +    }
  +
       public static void putLogger(Logger logger) {
   	loggers.put(logger.getName(), logger);
       }
  @@ -318,6 +335,7 @@
   
       protected boolean custom;
       protected Writer sink = defaultSink;
  +    String path;
       protected String name;
       
       protected static Writer defaultSink = new PrintWriter(System.err);
  
  
  
  1.2       +12 -7     jakarta-tomcat/src/share/org/apache/tomcat/service/JNIEndpoint.java
  
  Index: JNIEndpoint.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/JNIEndpoint.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JNIEndpoint.java	2000/02/09 12:00:53	1.1
  +++ JNIEndpoint.java	2000/03/25 03:35:27	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/JNIEndpoint.java,v
1.1 2000/02/09 12:00:53 rubys Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/02/09 12:00:53 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/JNIEndpoint.java,v
1.2 2000/03/25 03:35:27 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/03/25 03:35:27 $
    *
    * ====================================================================
    *
  @@ -102,7 +102,8 @@
       // -------------------- Public methods --------------------
   
       public synchronized void startEndpoint() {
  -	    running=true;
  +	System.out.println("Running ...");
  +	running=true;
           notify();
       }
   
  @@ -137,16 +138,19 @@
               StartupThread startup = new StartupThread(cmdLine,
                                                         this);
               startup.start();
  +	    System.out.println("Starting up StartupThread");
               synchronized (this) {
                   wait(60*1000);
               }
  +	    System.out.println("End waiting");
           } catch(Throwable t) {
           }
   
           if(running) {
  +	    System.out.println("Running fine ");
               return 1;
           }
  -
  +	System.out.println("Error - why doesn't run ??");
           return 0;
       }
   
  @@ -201,8 +205,9 @@
               t.printStackTrace();
           } finally {
               if(failed) {
  -                jniEp.stopEndpoint();
  +		System.out.println("Failed ??");
  +		jniEp.stopEndpoint();
               }
           }
       }
  -}
  \ No newline at end of file
  +}
  
  
  
  1.19      +9 -6      jakarta-tomcat/src/share/org/apache/tomcat/startup/Tomcat.java
  
  Index: Tomcat.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/Tomcat.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Tomcat.java	2000/03/24 03:29:38	1.18
  +++ Tomcat.java	2000/03/25 03:35:28	1.19
  @@ -74,7 +74,10 @@
   	xh.addRule( "ContextManager/Connector/Parameter", xh.methodParam(1, "value") );
       }
   
  -    	
  +
  +    /** Setup loggers when reading the configuration file - this will be called only when
  +     *  starting tomcat as deamon, all other modes will output to stderr
  +    */
       void setLogHelper( XmlMapper xh ) {
   	xh.addRule("Server/Logger",
   		   xh.objectCreate("org.apache.tomcat.logging.TomcatLogger"));
  @@ -90,10 +93,12 @@
        * used, the default configuration filename will be loaded from
        * the TOMCAT_HOME directory.
        *
  +     * If a relative config file is used, it will be relative to the current working
  +     * directory.
  +     *
        * @param cm The ContextManager we are configuring
        **/
       File getConfigFile(ContextManager cm) {
  -
   	// If configFile is already set, use it
   	if (configFile != null)
   	    return (new File(configFile));
  @@ -104,12 +109,12 @@
   	    System.out.println("No tomcat.home property, you need to set TOMCAT_HOME or add -Dtomcat.home");
   	    tchome = ".";	// Assume current working directory
   	}
  -	cm.setHome(tchome);
  +	// Home will be identical to tomcat home if default config is used.
  +	cm.setTomcatHome(tchome);
   	return (new File(tchome, DEFAULT_CONFIG));
   
       }
   
  -
       public void execute(String args[] ) throws Exception {
   	if( ! processArgs( args ) ) {
   	    System.out.println("Wrong arguments");
  @@ -173,8 +178,6 @@
   	xh.setDebug( 0 );
   	ContextManager cm=new ContextManager();
   	setConnectorHelper( xh );
  -
  -	// read only connector information out of server.xml
   	File f = getConfigFile(cm);
   	try {
   	    xh.readXml(f,cm);
  
  
  

Mime
View raw message