java.lang.ClassNotFoundException: org.hibernate.service.jta.platform.spi.JtaPlatform

java.lang.ClassNotFoundException: org.hibernate.service.jta.platform.spi.JtaPlatform

Intégration Spring 3.2.x + Hibernate 4.3.x, atteintJtaPlatform ClassNotFoundException, recherchez le chemin de classe du projet, découvrez queJtaPlatform est dans un package différent?

hibernate-core.4.3.5.Final.jar

org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform

Le message d'erreur afficheorg.hibernate.service.jta.platform.spi.JtaPlatform

Caused by: java.lang.NoClassDefFoundError: org/hibernate/service/jta/platform/spi/JtaPlatform
    at org.springframework.orm.hibernate4.SpringSessionContext.(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

  
  
    org.hibernate
    hibernate-core
    4.3.5.Final
  

  
  
    org.springframework
    spring-core
    3.2.8.RELEASE
  

  
    org.springframework
    spring-orm
    3.2.8.RELEASE
  

Solution

Depuis Hibernate 4.3.x, la classeJtaPlatform est refactorisée dans un nouveau package. To fix it, rétrograder Hibernate vers 4.2.x ou version antérieure, ou mettre à niveau le framework Spring.

Testé sur mon environnement de développement, voici la version qui fonctionne:

  1. Spring 3.2.8.RELEASE

  2. Hibernate 4.2.11.Final

pom.xml

  
    org.hibernate
    hibernate-core
    4.2.11.Final
  

  
    org.springframework
    spring-core
    3.2.8.RELEASE