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 2002/01/31 21:56:04 UTC

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

craigmcc    02/01/31 12:56:03

  Modified:    catalina/src/share/org/apache/catalina/connector/http
                        HttpConnector.java
               catalina/src/share/org/apache/catalina/core
                        StandardServer.java
  Log:
  Enhance the exception message produced when creating a server socket
  fails (typically due to an "Address in use" situation) to include the
  port number of the failed open.
  
  Enhancements to the proposed patch include:
  * If the socket is only for a particular IP address, report that also.
  * Add a similar enhancement to the message for the shutdown port opening
    (although you will normally encounter an error on the connector before
    running in to this one).
  
  PR: Bugzilla #6130
  Submitted by:	Jon Stevens <jo...@latchkey.com>
  
  Revision  Changes    Path
  1.30      +16 -6     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java
  
  Index: HttpConnector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- HttpConnector.java	20 Dec 2001 21:25:23 -0000	1.29
  +++ HttpConnector.java	31 Jan 2002 20:56:03 -0000	1.30
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v 1.29 2001/12/20 21:25:23 remm Exp $
  - * $Revision: 1.29 $
  - * $Date: 2001/12/20 21:25:23 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v 1.30 2002/01/31 20:56:03 craigmcc Exp $
  + * $Revision: 1.30 $
  + * $Date: 2002/01/31 20:56:03 $
    *
    * ====================================================================
    *
  @@ -66,6 +66,7 @@
   
   
   import java.io.IOException;
  +import java.net.BindException;
   import java.net.InetAddress;
   import java.net.ServerSocket;
   import java.net.Socket;
  @@ -102,7 +103,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.29 $ $Date: 2001/12/20 21:25:23 $
  + * @version $Revision: 1.30 $ $Date: 2002/01/31 20:56:03 $
    */
   
   
  @@ -972,14 +973,23 @@
           // If no address is specified, open a connection on all addresses
           if (address == null) {
               log(sm.getString("httpConnector.allAddresses"));
  -            return (factory.createSocket(port, acceptCount));
  +            try {
  +                return (factory.createSocket(port, acceptCount));
  +            } catch (BindException be) {
  +                throw new BindException(be.getMessage() + ":" + port);
  +            }
           }
   
           // Open a server socket on the specified address
           try {
               InetAddress is = InetAddress.getByName(address);
               log(sm.getString("httpConnector.anAddress", address));
  -            return (factory.createSocket(port, acceptCount, is));
  +            try {
  +                return (factory.createSocket(port, acceptCount, is));
  +            } catch (BindException be) {
  +                throw new BindException(be.getMessage() + ":" + address +
  +                                        ":" + port);
  +            }
           } catch (Exception e) {
               log(sm.getString("httpConnector.noAddress", address));
               return (factory.createSocket(port, acceptCount));
  
  
  
  1.21      +6 -5      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- StandardServer.java	26 Jan 2002 00:02:16 -0000	1.20
  +++ StandardServer.java	31 Jan 2002 20:56:03 -0000	1.21
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v 1.20 2002/01/26 00:02:16 amyroh Exp $
  - * $Revision: 1.20 $
  - * $Date: 2002/01/26 00:02:16 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v 1.21 2002/01/31 20:56:03 craigmcc Exp $
  + * $Revision: 1.21 $
  + * $Date: 2002/01/31 20:56:03 $
    *
    * ====================================================================
    *
  @@ -92,7 +92,7 @@
    * (but not required) when deploying and starting Catalina.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.20 $ $Date: 2002/01/26 00:02:16 $
  + * @version $Revision: 1.21 $ $Date: 2002/01/31 20:56:03 $
    */
   
   public final class StandardServer
  @@ -390,7 +390,8 @@
                   new ServerSocket(port, 1,
                                    InetAddress.getByName("127.0.0.1"));
           } catch (IOException e) {
  -            System.err.println("StandardServer.await: create: " + e);
  +            System.err.println("StandardServer.await: create[" + port
  +                               + "]: " + e);
               e.printStackTrace();
               System.exit(1);
           }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


[4.1] Updated installer script

Posted by Remy Maucherat <re...@apache.org>.
Hi,

I just updated the installer for Windows, which is (at last) getting a bit
more flexible, using . At the end of the installation, the user will be
prompted for the port number the HTTP/1.1 connector will run on, as well as
the l/p of the admin account (which can be used for either the manager
webapp or the admin webapp).

Then, a shortcut to the admin webapp is created (using the port number
specified above, of course).

This should allow to "bootstrap" the setup and allow the user to use the
admin webapp right away (without editing any config files by hand).

The code in the script is hackish. See commit message for more details.

Remy


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

Posted by Jon Scott Stevens <jo...@latchkey.com>.
Thanks guys for making the changes...I'm sorry I didn't come up with a
perfect patch that would be easily applied, I just didn't want to step on
toes or do something wrong as a result of my lack of familiarity of the
entire code base.

thanks,

-jon

on 1/31/02 1:13 PM, "Craig R. McClanahan" <cr...@apache.org> wrote:

> On Thu, 31 Jan 2002, Remy Maucherat wrote:
> 
>> Date: Thu, 31 Jan 2002 13:06:35 -0800
>> From: Remy Maucherat <re...@apache.org>
>> Reply-To: Tomcat Developers List <to...@jakarta.apache.org>
>> To: Tomcat Developers List <to...@jakarta.apache.org>
>> Subject: Re: cvs commit:
>>     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core
>>     StandardServer.java
>> 
>>>>>   PR: Bugzilla #6130
>>>>>   Submitted by: Jon Stevens <jo...@latchkey.com>
>>>> 
>>>> +1 for the change.
>>> 
>>> Does that mean ok for 4.0.2 as well?
>> 
>> Nope, but +1 too. I don't see what anything it could break.
>> 
> 
> OK, will do it in a sec.
> 
>> Remy
>> 
>> 
> 
> Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 31 Jan 2002, Remy Maucherat wrote:

> Date: Thu, 31 Jan 2002 13:06:35 -0800
> From: Remy Maucherat <re...@apache.org>
> Reply-To: Tomcat Developers List <to...@jakarta.apache.org>
> To: Tomcat Developers List <to...@jakarta.apache.org>
> Subject: Re: cvs commit:
>     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core
>     StandardServer.java
>
> > > >   PR: Bugzilla #6130
> > > >   Submitted by: Jon Stevens <jo...@latchkey.com>
> > >
> > > +1 for the change.
> >
> > Does that mean ok for 4.0.2 as well?
>
> Nope, but +1 too. I don't see what anything it could break.
>

OK, will do it in a sec.

> Remy
>
>

Craig


> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

Posted by Remy Maucherat <re...@apache.org>.
> > >   PR: Bugzilla #6130
> > >   Submitted by: Jon Stevens <jo...@latchkey.com>
> >
> > +1 for the change.
> 
> Does that mean ok for 4.0.2 as well?

Nope, but +1 too. I don't see what anything it could break.

Remy


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 31 Jan 2002, Remy Maucherat wrote:

> Date: Thu, 31 Jan 2002 13:01:48 -0800
> From: Remy Maucherat <re...@apache.org>
> Reply-To: Tomcat Developers List <to...@jakarta.apache.org>
> To: Tomcat Developers List <to...@jakarta.apache.org>
> Subject: Re: cvs commit:
>     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core
>     StandardServer.java
>
> > craigmcc    02/01/31 12:56:03
> >
> >   Modified:    catalina/src/share/org/apache/catalina/connector/http
> >                         HttpConnector.java
> >                catalina/src/share/org/apache/catalina/core
> >                         StandardServer.java
> >   Log:
> >   Enhance the exception message produced when creating a server socket
> >   fails (typically due to an "Address in use" situation) to include the
> >   port number of the failed open.
> >
> >   Enhancements to the proposed patch include:
> >   * If the socket is only for a particular IP address, report that also.
> >   * Add a similar enhancement to the message for the shutdown port opening
> >     (although you will normally encounter an error on the connector before
> >     running in to this one).
> >
> >   PR: Bugzilla #6130
> >   Submitted by: Jon Stevens <jo...@latchkey.com>
>
> +1 for the change.

Does that mean ok for 4.0.2 as well?

> Sorry Jon, I didn't have much time to apply it :-(
>
> Remy
>

Craig


>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

Posted by Remy Maucherat <re...@apache.org>.
> craigmcc    02/01/31 12:56:03
>
>   Modified:    catalina/src/share/org/apache/catalina/connector/http
>                         HttpConnector.java
>                catalina/src/share/org/apache/catalina/core
>                         StandardServer.java
>   Log:
>   Enhance the exception message produced when creating a server socket
>   fails (typically due to an "Address in use" situation) to include the
>   port number of the failed open.
>
>   Enhancements to the proposed patch include:
>   * If the socket is only for a particular IP address, report that also.
>   * Add a similar enhancement to the message for the shutdown port opening
>     (although you will normally encounter an error on the connector before
>     running in to this one).
>
>   PR: Bugzilla #6130
>   Submitted by: Jon Stevens <jo...@latchkey.com>

+1 for the change.
Sorry Jon, I didn't have much time to apply it :-(

Remy


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 31 Jan 2002, Jon Scott Stevens wrote:

> >
> >
> > @@ -972,14 +973,23 @@
> >          // If no address is specified, open a connection on all addresses
> >          if (address == null) {
> >              log(sm.getString("httpConnector.allAddresses"));
> > -            return (factory.createSocket(port, acceptCount));
> > +            try {
> > +                return (factory.createSocket(port, acceptCount));
> > +            } catch (BindException be) {
> > +                throw new BindException(be.getMessage() + ":" + port);
> > +            }
> >          }
> >

This is "the one above" (when address == null)

> >          // Open a server socket on the specified address
> >          try {
> >              InetAddress is = InetAddress.getByName(address);
> >              log(sm.getString("httpConnector.anAddress", address));
> > -            return (factory.createSocket(port, acceptCount, is));
> > +            try {
> > +                return (factory.createSocket(port, acceptCount, is));
> > +            } catch (BindException be) {
> > +                throw new BindException(be.getMessage() + ":" + address +
> > +                                        ":" + port);
> > +            }

and this is "the one below"

> >          } catch (Exception e) {
> >              log(sm.getString("httpConnector.noAddress", address));
> >              return (factory.createSocket(port, acceptCount));
>

but this is "the one I forgot".  Fixed in a sec.

> Hey Craig, there is another factory.createSocket that gets created in the
> catch clause right above...seems that that should be in a
> try/catch(BindException) as well, doesn't it?
>
> That is why I originally wrapped so much of the code in a single
> try/catch...

I've been burnt a few times by long try/catch blocks, wondering exactly
which statement threw the exception, so it's just a habit to make the
scope as narrow as possible.

>
> -jon
>

Craig

>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

Posted by Jon Scott Stevens <jo...@latchkey.com>.
on 1/31/02 12:56 PM, "craigmcc@apache.org" <cr...@apache.org> wrote:

> craigmcc    02/01/31 12:56:03
> 
> Modified:    catalina/src/share/org/apache/catalina/connector/http
>                       HttpConnector.java
>              catalina/src/share/org/apache/catalina/core
>                       StandardServer.java
> Log:
> Enhance the exception message produced when creating a server socket
> fails (typically due to an "Address in use" situation) to include the
> port number of the failed open.
> 
> Enhancements to the proposed patch include:
> * If the socket is only for a particular IP address, report that also.
> * Add a similar enhancement to the message for the shutdown port opening
>   (although you will normally encounter an error on the connector before
>   running in to this one).
> 
> PR: Bugzilla #6130
> Submitted by:    Jon Stevens <jo...@latchkey.com>
> 
> Revision  Changes    Path
> 1.30      +16 -6 
> jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpC
> onnector.java
> 
> Index: HttpConnector.java
> ===================================================================
> RCS file: 
> /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/
> http/HttpConnector.java,v
> retrieving revision 1.29
> retrieving revision 1.30
> diff -u -r1.29 -r1.30
> --- HttpConnector.java    20 Dec 2001 21:25:23 -0000    1.29
> +++ HttpConnector.java    31 Jan 2002 20:56:03 -0000    1.30
> @@ -1,7 +1,7 @@
>  /*
> - * $Header: 
> /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/
> http/HttpConnector.java,v 1.29 2001/12/20 21:25:23 remm Exp $
> - * $Revision: 1.29 $
> - * $Date: 2001/12/20 21:25:23 $
> + * $Header: 
> /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/
> http/HttpConnector.java,v 1.30 2002/01/31 20:56:03 craigmcc Exp $
> + * $Revision: 1.30 $
> + * $Date: 2002/01/31 20:56:03 $
>   *
>   * ====================================================================
>   *
> @@ -66,6 +66,7 @@
>  
>  
>  import java.io.IOException;
> +import java.net.BindException;
>  import java.net.InetAddress;
>  import java.net.ServerSocket;
>  import java.net.Socket;
> @@ -102,7 +103,7 @@
>   *
>   * @author Craig R. McClanahan
>   * @author Remy Maucherat
> - * @version $Revision: 1.29 $ $Date: 2001/12/20 21:25:23 $
> + * @version $Revision: 1.30 $ $Date: 2002/01/31 20:56:03 $
>   */
>  
>  
> @@ -972,14 +973,23 @@
>          // If no address is specified, open a connection on all addresses
>          if (address == null) {
>              log(sm.getString("httpConnector.allAddresses"));
> -            return (factory.createSocket(port, acceptCount));
> +            try {
> +                return (factory.createSocket(port, acceptCount));
> +            } catch (BindException be) {
> +                throw new BindException(be.getMessage() + ":" + port);
> +            }
>          }
>  
>          // Open a server socket on the specified address
>          try {
>              InetAddress is = InetAddress.getByName(address);
>              log(sm.getString("httpConnector.anAddress", address));
> -            return (factory.createSocket(port, acceptCount, is));
> +            try {
> +                return (factory.createSocket(port, acceptCount, is));
> +            } catch (BindException be) {
> +                throw new BindException(be.getMessage() + ":" + address +
> +                                        ":" + port);
> +            }
>          } catch (Exception e) {
>              log(sm.getString("httpConnector.noAddress", address));
>              return (factory.createSocket(port, acceptCount));

Hey Craig, there is another factory.createSocket that gets created in the
catch clause right above...seems that that should be in a
try/catch(BindException) as well, doesn't it?

That is why I originally wrapped so much of the code in a single
try/catch...

-jon


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>