Re: bug - connection problem with jdk 1.7 ?

From: Dave Cramer <davecramer(at)gmail(dot)com>
To: tim(dot)lambrechts(at)laposte(dot)net
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: bug - connection problem with jdk 1.7 ?
Date: 2014-03-27 14:57:50
Message-ID: CADK3HH+oJEzy8vfFyiMHVawpMNeVE3M1htMN6wuSuB3s2Jf64g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Tim,

Since this is the first time hearing about this; I'm not sure where else
you went in the postgresql community.

Yes, the jar does contain the name of the driver. When you say you have a
problem what does this mean. I have no problem loading the driver from code
written in either eclipse or Intellij

I would need more information in order to be able to replicate this problem
on my machine.

Is it possible you have another postgresql jar loading first somehow that
does not have the meta data in the jar ?

Dave Cramer

On Thu, Mar 27, 2014 at 10:36 AM, <tim(dot)lambrechts(at)laposte(dot)net> wrote:

> (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
>
>
>
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Lachezar Dobrev 2014-03-27 16:58:23 Re: Slow performance with 9.3-110x JDBC 4
Previous Message tim.lambrechts 2014-03-27 14:36:56 bug - connection problem with jdk 1.7 ?