java.lang.ClassNotFoundException: org.hibernate.service.jta.platform.spi.JtaPlatform
Spring 3.2.x + Hibernate 4.3.x integration, hits JtaPlatform
ClassNotFoundException, search the project classpath, find out that JtaPlatform
is at different package?
hibernate-core.4.3.5.Final.jar
org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform
Error message shows org.hibernate.service.jta.platform.spi.JtaPlatform
Caused by: java.lang.NoClassDefFoundError: org/hibernate/service/jta/platform/spi/JtaPlatform
at org.springframework.orm.hibernate4.SpringSessionContext.<init>(SpringSessionContext.java:56)
~[spring-orm-3.2.8.RELEASE.jar:3.2.8.RELEASE]
... 40 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.hibernate.service.jta.platform.spi.JtaPlatform
//...
pom.xml
<!-- Hibernate ORM -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.5.Final</version>
</dependency>
<!-- Spring 3 dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.2.8.RELEASE</version>
</dependency>
Solution
Since Hibernate 4.3.x, the JtaPlatform
class is refactored to a new package. To fix it, downgrade Hibernate to 4.2.x or older, or upgrade the Spring framework.
Tested on my development environment, here are the version that works :
- Spring 3.2.8.RELEASE
- Hibernate 4.2.11.Final
pom.xml
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.2.11.Final</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.8.RELEASE</version>
</dependency>
This is a very resourceful tutorial… thanks alot..
thank man
Thanks a lot!