pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steven Schlansker <stevenschlansker@gmail.com>
To: Venkateswar Reddy Melachervu <vmelachervu@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: pgsql jdbc db connection weird behaviour
Date: Sun, 30 Mar 2014 00:29:22 -0500
Message-ID: <078EE923-CCF6-45FA-B0EB-C18FC42C0D5B@gmail.com> (raw)
In-Reply-To: <CAFbMEWUOehVa69xWYT7iS8RR8Uufn80DNchv9yVp=XtBf0MP9A@mail.gmail.com>
References: <CAFbMEWUOehVa69xWYT7iS8RR8Uufn80DNchv9yVp=XtBf0MP9A@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>


On Mar 30, 2014, at 12:10 AM, Venkateswar Reddy Melachervu <vmelachervu@gmail.com> wrote:

> Hello PGSQL Community,
> Love pgsql. But facing this weird problem (detailed below) for past couple of days with pgsql jdbc41 driver with tomcat 8 connection pooling on on jvm1.8 (all on x64 windows 8) with no resolution in sight for casting a jdbc db tomcat pooled connection to PGConnection hitting the wall. 
> 
> I am sure not sure if I am doing something silly or it is the limitation of pgsql jdbc41 driver. Did any one face any such issue? Does any one know some way out for this?
> 
> Problem:
> When I try to cast a DB Connection obtained using tomcat jdbc resource (pooled) to org.postgresql.PGConnection, of course after unwrapping it, execution is running into exception with the message: (java.lang.ClassCastException) java.lang.ClassCastException: org.postgresql.jdbc4.Jdbc4Connection cannot be cast to org.postgresql.PGConnection

Almost always this is caused by having more than one driver jar file available in your class path.  In particular, bundling a driver in the Tomcat lib/ directory as well as within your application itself is sure to cause problems.

That’s where I would look first.

Hope that helps,
Steven



-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (6+ messages)  latest in thread

Message-ID: <078EE923-CCF6-45FA-B0EB-C18FC42C0D5B@gmail.com>
Permalink:  ../078EE923-CCF6-45FA-B0EB-C18FC42C0D5B@gmail.com/
Also on:    postgresql.org/message-id/078EE923-CCF6-45FA-B0EB-C18FC42C0D5B@gmail.com

 · 

reply

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: stevenschlansker@gmail.com, vmelachervu@gmail.com
  Subject: Re: pgsql jdbc db connection weird behaviour
  In-Reply-To: <078EE923-CCF6-45FA-B0EB-C18FC42C0D5B@gmail.com>
  References: <CAFbMEWUOehVa69xWYT7iS8RR8Uufn80DNchv9yVp=XtBf0MP9A@mail.gmail.com> <078EE923-CCF6-45FA-B0EB-C18FC42C0D5B@gmail.com>

* 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