springhibernate

java.lang.NoClassDefFoundError: org/springframework/orm/hibernate5/HibernateTransactionManager


I am trying to integrate spring with hibernate and I have spring-orm .4.3.6 jar file in my project.But still I am getting below error :

java.lang.NoClassDefFoundError: org/springframework/orm/hibernate5/HibernateTransactionManager
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:613)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:524)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:510)
at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:570)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:697)

Tried googling it.But did not find answer. Can someone help?


Solution

  • This class is coming out of the spring-orm dependency (notice the hibernate5 package in there. There is equally hibernate3 and hibernate4 packages in the same jar not to break compatibility).

    The Maven Coordinates are:

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>4.3.10.RELEASE</version>
    </dependency>