I am running tomcat standalone on WinNT 4.0. Following the instructions in the user's guide, I removed the unneeded the unneeded Ajp12 connector. Now my server.xml only contains:
 
<Connector className="org.apache.tomcat.service.SimpleTcpConnector">
            <Parameter
                name="handler"
                value="org.apache.tomcat.service.http.HttpConnectionHandler"/>
            <Parameter
                name="port"
                value="8080"/>
        </Connector>
However, when I go to shutdown tomcat, I get the following error:
 
Stop tomcat
java.net.ConnectException: Connection refused: no further information
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(Unknown Source)
        at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at org.apache.tomcat.startup.Tomcat.stopTomcat(Tomcat.java:208)
        at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:130)
        at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:163)
 
I looked at stopTomcat() method on Tomcat.java and this method seems to assume port 8007 and the Ajp12 connector:
 
    /** Stop tomcat using the configured cm
     *  The manager is set up using the same configuration file, so
     *  it will have the same port as the original instance ( no need
     *  for a "log" file).
     *  It uses the Ajp12 connector, which has a built-in "stop" method,
     *  that will change when we add real callbacks ( it's equivalent
     *  with the previous RMI method from almost all points of view )
     */
....
 // Find Ajp12 connector
 int portInt=8007;
 Enumeration enum=cm.getConnectors();
 while( enum.hasMoreElements() ) {
     Object con=enum.nextElement();
     if( con instanceof  TcpEndpointConnector ) {
  TcpEndpointConnector tcpCon=(TcpEndpointConnector) con;
  if( tcpCon.getTcpConnectionHandler()  instanceof Ajp12ConnectionHandler ) {
      portInt=tcpCon.getPort();
  }
     }
 }
 
 // use Ajp12 to stop the server...
 try {
     Socket socket = new Socket("localhost", portInt);
     OutputStream os=socket.getOutputStream();
     byte stopMessage[]=new byte[2];
     stopMessage[0]=(byte)254;
     stopMessage[1]=(byte)15;
     os.write( stopMessage );
     socket.close();
 } catch(Exception ex ) {
     ex.printStackTrace();
 }
 
 
Does this mean that I have to keep the Ajp12 connector in the server.xml file to properly shutdown tomcat?

Ren�e Petris
Overseer of the Execution
Loudeye Technologies
[EMAIL PROTECTED]

414 Olive Way, Suite 300
Seattle, WA 98101
206-832-4500 phone
206-832-4475 fax

 

Reply via email to