Main Tutorials

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 :

  1. Spring 3.2.8.RELEASE
  2. 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>

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
3 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Dhirendra Hamal
8 years ago

This is a very resourceful tutorial… thanks alot..

amine
9 years ago

thank man

Edgar de Graaff
9 years ago

Thanks a lot!