i am trying to integrate my already working spring project with hibernate, but this is the error i am getting on start up.
EVERE: Servlet.service() for servl
I was having similar kind of trouble; used a different version of apache-camel-extra helped resolving the problem
compile group: 'org.apache-extras.camel-extra', name: 'camel-hibernate', version: '2.18.0'
Our application setup
gradle
apache-camel
spring
hibernate
spring-jta and atomikos
If you are using Eclipse as IDE and maven as a build tool, try to check build path entries. Sometimes, old JARs are added as classpath entries which are not overridden by maven clean or update.
You would need to remove those entries.
Refer below image
Above entries should not be present in build path, since they are not overridden by maven clean.
The problem is that you have hibernate-core-4.0.0.Final.jar
in your classpath, but Spring 3.1 uses hibernate-core-3.6.0.Final.jar
(see here Spring 3.1 artifact and dependencies).
Remove Hibernate 4.0 and put Hibernate 3.6 instead in your classpath.
BTW, there might some more such miss matches. It's better to use maven to take care of dependencies.
EDIT - some more details
In Hibernate 3.6 the interface Session
was in package org.hibernate.classic
whereas in Hibernate 4.0 it was moved to the package org.hibernate
.
In Hibernate 3.6 the SessionFactory.openSession
no longer returns an org.hibernate.classic.Session
, rather it returns an org.hibernate.Session
. This is a refactor that breaks client code...
This error is caused by transitive dependency of maven managed projects. Child will be using a particular version of an artefact but the parent would fetch a later version. In my case, I had to use
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.11.Final</version>
</dependency>
</dependencies>
In the parent pom (i.e, I have specified the dependency version again in parent pom) to avoid this conflict.