Exception in GWT Dev Mode + Spring 3.1 + Hibernate 4.0.1 Exception in GWT Dev Mode + Spring 3.1 + Hibernate 4.0.1 spring spring

Exception in GWT Dev Mode + Spring 3.1 + Hibernate 4.0.1


This issue is fixed in Hibernate 4.1.4.


I had the same problem, and it seems to be related to the Jetty classloader (the GWT plugin uses Jetty for hosted mode), the GWT plugin and Hibernate (although it apparently crops up with other libraries as well).

It's similar to the bug mentioned here Hibernate Bug Report but in our cases we're running it via the GWT plugin and it causes a ClassCastException for the ConnectionProvider.

The fix mentioned in the bug report should fix that particular problem.

For org.hibernate.service.classloading.internalClassLoaderServiceImpl set the parent to null via the constructor:

this.classClassLoader = new ClassLoader(null) {        @Override        protected Class<?> findClass(String name) throws ClassNotFoundException {            for ( ClassLoader loader : classLoadingClassLoaders ) {                try {                    return loader.loadClass( name );                }                catch (Exception ignore) {                }            }            throw new ClassNotFoundException( "Could not load requested class : " + name );        }};


remove ejb3-persistence.jar in the /lib directory if already there; it conflicts with hibernate-jpa-2.0-api-1.0.1.Final.jar in hibernate 4. That worked for me after having this issue, I achieved to host a GWT, Hibernate 4, Spring 3.1.1 app on Openshift environment https://openshift.redhat.com/app/


I think you don't need to set <provider>org.hibernate.ejb.HibernatePersistence</provider> in persistence.xml. Check the docs.