users@glassfish.java.net

[hibernate EntityManager] No suitable driver found for jdbc:postgresql://localhost:5432/omar4

From: Farrukh Najmi <farrukh_at_wellfleetsoftware.com>
Date: Mon, 25 Jan 2010 19:13:48 -0500

Hi Mitesh,

After following instructions in:

a)
http://blogs.sun.com/GlassFishPersistence/entry/using_hibernate_as_jpa_provider

b) <gfv3-installdir>/hibernate/overview.txt

I added "<provider>org.hibernate.ejb.HibernatePersistence</provider>" to
my persistence.xml file like and now I am getting the hibernate
EntityManagerFactory instead of the EclipseLink one (phew!).

But now I get a different error which also seems to be related to my use
of hibernate:

WARNING: Could not obtain connection to query metadata
java.sql.SQLException: No suitable driver found for
jdbc:postgresql://localhost:5432/omar4
        at java.sql.DriverManager.getConnection(DriverManager.java:602)
        at java.sql.DriverManager.getConnection(DriverManager.java:154)
        at
org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
        at
org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:114)
        at
org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2145)
        at
org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2141)
        at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1365)
        at
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:858)
        at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:733)
        at
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:152)
        at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:78)


This seems to be a classloader type issue since the posgres driver is
definitely part of my war file. I have the following in my wars
WEB-INF/lib directory:

postgres-jdbc-1.1.6.jar
postgres-8.3-603.jdbc3.jar

So what could be causing this new problem?

Farrukh Najmi wrote:
>
> Thanks Mitesh for the info. I have worked around this issue by
> generating Serializable bindings but now am seeing other issues in
> EclipseLink.
> I am realizing that I should not be in EclipseLink code at all since I
> use hibernate JPA provider. Please confirm.
>
> If true then there is something that has changed between GF V3 Prelude
> and GF V3 Final that impact which EntityManagerFactory my code
> creates. Seems that right now it is creating the one for EclipseLink
> rather than for hibernate and that is where all my problems seem to be
> originating from. It is also possible that my code needs to be made
> more deterministic in which EnityManagerFactory is being created.
>
> I will debug this some more but do let me know if you spot an obvious
> reason why I am getting into EclipseLink code when using hibernate JPA
> and how I can avoid it. Thanks.
>


-- 
Regards,
Farrukh
Web: http://www.wellfleetsoftware.com