Is this a bug? java.net.BindException: Address already in use: connect - Mailing list pgsql-general

From Michael Mattox
Subject Is this a bug? java.net.BindException: Address already in use: connect
Date
Msg-id CJEBLDCHAADCLAGIGCOOKEHBCKAA.michael.mattox@verideon.com
Whole thread Raw
List pgsql-general
I'm getting a "java.net.BindException: Address already in use" error while
load testing my application, the line causing the error is:

        try {
            con =
                DriverManager.getConnection(
                    url,
                    properties.getProperty(IGlobalKeys.JDBC_USERNAME),
                    properties.getProperty(IGlobalKeys.JDBC_PASSWORD));

And in the finally block I have:

        } finally {
            try {
                if (con != null && !con.isClosed())
                    con.close();
            } catch (SQLException e) {
            }
        }

I'm not sure why or how the DriverManager is getting a connection that's
already in use.  I'm using PostgreSQL 7.3.2 with Cygwin on Windows 2000 with
the pg73jdbc3.jar driver and JDK 1.4.1_03.  Here's the stack trace:

The connection attempt failed because Exception: java.net.BindException:
Address already in use: connect
Stack Trace:

java.net.BindException: Address already in use: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
    at java.net.Socket.connect(Socket.java:434)
    at java.net.Socket.connect(Socket.java:384)
    at java.net.Socket.<init>(Socket.java:291)
    at java.net.Socket.<init>(Socket.java:119)
    at org.postgresql.PG_Stream.<init>(PG_Stream.java:38)
    at
org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Con
nection.java:160)
    at org.postgresql.Driver.connect(Driver.java:122)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at
com.verideon.veriguard.services.ReportService.getMonitorStatus(ReportService
.java:293)




pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: plpython? (Was: Re: Damn triggers and NEW)
Next
From: "scott.marlowe"
Date:
Subject: Re: Linux supports hot-swappable hardware? [was Re: