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?

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>

上一篇: Spring Security + Hibernate XML Example
下一篇: MongoDB Aggregate and Group example
 评论 ( What Do You Think )
名称
邮箱
网址
评论
验证
   
 

 


  • 微信公众号

  • 我的微信

站点声明:

1、一号门博客CMS,由Python, MySQL, Nginx, Wsgi 强力驱动

2、部分文章或者资源来源于互联网, 有时候很难判断是否侵权, 若有侵权, 请联系邮箱:summer@yihaomen.com, 同时欢迎大家注册用户,主动发布无版权争议的 文章/资源.

3、鄂ICP备14001754号-3, 鄂公网安备 42280202422812号