Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Aug 2019 20:34:15 +0000
From:      bugzilla-noreply@freebsd.org
To:        java@FreeBSD.org
Subject:   [Bug 239890] java/openjdk11: openjdk 11.0.4+11.2 JDBC connections fail with IPv6 addresses
Message-ID:  <bug-239890-8522-A7xAYlBNFf@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-239890-8522@https.bugs.freebsd.org/bugzilla/>
References:  <bug-239890-8522@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D239890

--- Comment #5 from Jonathan Chen <jonc@chen.org.nz> ---
Actually, it looks like the use of java.net.preferIPv4Stack=3Dtrue is actua=
lly
hiding a problem with OpenJDK11's IP address handling:

1.stormblade:jdbc-test,8:31am> ls=20=20=20=20
J.java                 postgresql-42.2.6.jar=20=20=20=20
1.stormblade:jdbc-test,8:31am> cat J.java=20=20=20=20=20
import java.sql.*;=20=20

public class J=20=20
{=20=20
        public static void=20=20
        main (=20=20
                String args[])=20=20
                throws Exception=20=20
        {=20=20
                String url =3D
"jdbc:postgresql://127.0.0.1/postgres?user=3Dpostgres";=20=20
                Connection conn =3D DriverManager.getConnection(url);=20=20
        }=20=20
}=20=20
1.stormblade:jdbc-test,8:31am> setenv JAVA_HOME /usr/local/openjdk8
1.stormblade:jdbc-test,8:31am> javac J.java=20=20=20=20
1.stormblade:jdbc-test,8:31am> java -cp .:postgresql-42.2.6.jar
-Djava.net.preferIPv4Stack=3Dfalse J=20=20=20
1.stormblade:jdbc-test,8:32am> setenv JAVA_HOME /usr/local/openjdk11=20=20=
=20=20
1.stormblade:jdbc-test,8:32am> java -cp .:postgresql-42.2.6.jar
-Djava.net.preferIPv4Stack=3Dfalse J=20=20=20=20
Exception in thread "main" org.postgresql.util.PSQLException: Connection to
127.0.0.1:5432 refused. Check that the hostname and port are correct and th=
at
the
 postmaster is accepting TCP/IP connections.=20=20
        at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionF=
actoryImpl.java:280)=20
        at
org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java=
:49)=20
        at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195)=
=20=20
        at org.postgresql.Driver.makeConnection(Driver.java:458)=20=20
        at org.postgresql.Driver.connect(Driver.java:260)=20=20
        at
java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)=20=20
        at
java.sql/java.sql.DriverManager.getConnection(DriverManager.java:251)=20=20
        at J.main(J.java:11)=20=20
Caused by: java.net.ConnectException: Invalid argument (connect failed)=20=
=20
        at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)=
=20=20
        at
java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImp=
l.java:399)=20
        at
java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSo=
cketImpl.java:242)=20
        at
java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.=
java:224)=20
        at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:=
403)=20
        at java.base/java.net.Socket.connect(Socket.java:591)=20=20
        at org.postgresql.core.PGStream.<init>(PGStream.java:75)=20=20
        at
org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryIm=
pl.java:91)=20
        at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionF=
actoryImpl.java:192)=20
        ... 7 more=20=20
1.stormblade:jdbc-test,8:32am>

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-239890-8522-A7xAYlBNFf>