-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Hibernate 4.0.1 can't load postgresql dialect
PostPosted: Wed Feb 01, 2012 1:23 pm 
Newbie

Joined: Wed Jun 27, 2007 3:26 pm
Posts: 7
Hi,

I just upgraded to Hibernate 4.0.1 (to try and resolve an issue that causes the JVM to crash).

However, when I try to start my EntityManager, I get the following error:
Code:
   ... 22 more
Caused by: org.hibernate.HibernateException: Could not instantiate dialect class
   at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.constructDialect(DialectFactoryImpl.java:82)
   at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:64)
   at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:148)
   at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71)
   at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2270)
   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2266)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1735)
   at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)
   at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
   ... 34 more
Caused by: java.lang.ClassCastException: org.hibernate.dialect.PostgreSQLDialect cannot be cast to org.hibernate.dialect.Dialect
   at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.constructDialect(DialectFactoryImpl.java:73)
   ... 45 more


I have search the classpath, and there is no other copy of PostgreSQLDialect to be found anywhere.
Anyone else have this problem?


Top
 Profile  
 
 Post subject: Re: Hibernate 4.0.1 can't load postgresql dialect
PostPosted: Wed Feb 01, 2012 1:31 pm 
Newbie

Joined: Wed Jun 27, 2007 3:26 pm
Posts: 7
Hmmm, I created a new empty project, and I don't have the same problem.

The old PG dialect must be in there somewhere, I guess.


Top
 Profile  
 
 Post subject: Re: Hibernate 4.0.1 can't load postgresql dialect
PostPosted: Wed Feb 01, 2012 3:29 pm 
Newbie

Joined: Wed Jun 27, 2007 3:26 pm
Posts: 7
Argh this is driving me nuts!

If I run my GWT project from a jar, it works correctly.
If I run it from eclipse, it fails with said error, cannot cast PostgreSQLDialect to Dialect.
But I have searched all of eclipse for a jar containing org.hibernate.dialect, and there's nothing!
I also deleted my project and rechecked it out of subversion, and the problem persisted.

Even better, as a test I did the following:
Code:
Object o = EntityManager.class.getClassLoader().loadClass("org.hibernate.dialect.PostgreSQLDialect").newInstance();
Class klass = o.getClass();
System.out.println(klass.getResource("/" + klass.getName().replace(".", "/") + ".class").toExternalForm());
         
klass = Dialect.class;
System.out.println(klass.getResource("/" + klass.getName().replace(".", "/") + ".class").toExternalForm());
Dialect d = (Dialect)o;


This results in:
Code:
jar:file:/home/{blah}/war/WEB-INF/lib/hibernate-core-4.0.1.Final.jar!/org/hibernate/dialect/PostgreSQLDialect.class
jar:file:/home/{blah}/war/WEB-INF/lib/hibernate-core-4.0.1.Final.jar!/org/hibernate/dialect/Dialect.class
Caused by: java.lang.ClassCastException: org.hibernate.dialect.PostgreSQLDialect cannot be cast to org.hibernate.dialect.Dialect




If anyone has any ideas, would love to hear them!


Top
 Profile  
 
 Post subject: Re: Hibernate 4.0.1 can't load postgresql dialect
PostPosted: Thu Feb 02, 2012 11:09 am 
Newbie

Joined: Wed Jun 27, 2007 3:26 pm
Posts: 7
This is apparently caused by the Google Web Toolkit DevMode JettyLauncher ClassLoaderExtension.
I do not have a workaround, other than to revert Hibernate to 3.x


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.