From: tim.lambrechts@laposte.net
To: pgsql-jdbc@postgresql.org
Subject: bug - connection problem with jdk 1.7 ?
Date: Thu, 27 Mar 2014 15:36:56 +0100
Message-ID: <1720810354.91914.1395931016609.JavaMail.www@wwinf8223> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>
(I send this e-mail again, because I hadn't subscribed me to the mailing list)
Hello,
I already presented on the devshed forum a connection problem to postgresql with the jdbc jar file postgresql-9.3-1100.jdbc41.jar. Nobody answered me.
Until recently I thought that the origin of the problem was maybe Eclipse, but now I have tested the same code with a recent version of another development tool, Intellij IDEA, and the problem is still the same.
That’s why I begin to think that the postgresql-9.3-1100.jdbc41.jar file doesn’t function correctly with the jdk 1.7 (version 51.0), moreover because the same code worked very well with jdk 1.6, postgresql 9.0 and postgresql-9.0-801.jdbc4.jar.
So, now I repeat the explanation of the jdbc connection problem that I gave on the devshed forum:
Recently I bought a new computer and installed a running project with upgraded versions of windows (windows 7, 64 bit), eclipse (4.3.1), java (jdk 1.7 : 51.0), postgresql (9.3) and jdbc (postgresql-9.3-1100.jdbc41.jar).
On the older versions the programs ran without any problem, but now there is an exception in the following code:
public static final String DBURL = "jdbc:postgresql:MR";
public static final String DBUSER = "postgres";
. . .
public static Connection createConnection () throws SQLException {
Properties props = new Properties();
props.setProperty("user",DBUSER);
return DriverManager.getConnection(DBURL, props);
}
. . .
A NullPointerException occurs on the line of the return, while DriverManager.getConnection(String, Properties) normally throws an SQLException.
In debugging mode the stackTrace of Throwable e says: “org.eclipse.debug.core.DebugException: com.sun.jdi.ClassNotLoadedException: Type has not been loaded occurred while retrieving component type of array.”
The jar file is included in the build path of eclipse and the .classpath file is the same as before. It also contains the node . The Eclipse build works well and all the class files of the jar file can be opened and read.
The API documentation for the DriverManager class says: “JDBC 4.0 Drivers must include the file META-INF/services/java.sql.Driver. This file contains the name of the JDBC drivers implementation of java.sql.Driver.”
When looking in the postgresql-9.3-1100.jdbc41.jar file in Eclipse the META-INF/services/java.sql.Driver file shows one line: org.postgresql.Driver. The package org.postgresql contains the Driver.class file.
In the same way, in the Intellij development tool everything seems to be ok, until a NullPointerException is thrown on the same line:
return DriverManager.getConnection(DBURL, props);
Sorry, if this is not a bug, but until now I have had no help from postrgresql community and I'm quite stuck with this problem.
Cheers.
Tim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: tim.lambrechts@laposte.net
Subject: Re: bug - connection problem with jdk 1.7 ?
In-Reply-To: <1720810354.91914.1395931016609.JavaMail.www@wwinf8223>
References: <1720810354.91914.1395931016609.JavaMail.www@wwinf8223>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox