bug - connection problem with jdk 1.7 ? - Mailing list pgsql-jdbc

From tim.lambrechts@laposte.net
Subject bug - connection problem with jdk 1.7 ?
Date
Msg-id 1720810354.91914.1395931016609.JavaMail.www@wwinf8223
Whole thread Raw
Responses Re: bug - connection problem with jdk 1.7 ?
List pgsql-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

 

pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: Slow performance with 9.3-110x JDBC 4
Next
From: Dave Cramer
Date:
Subject: Re: bug - connection problem with jdk 1.7 ?