java.lang.ClassNotFoundException: org.springframework.orm.hibernate4.LocalSessionFactoryBean java.lang.ClassNotFoundException: org.springframework.orm.hibernate4.LocalSessionFactoryBean spring spring

java.lang.ClassNotFoundException: org.springframework.orm.hibernate4.LocalSessionFactoryBean


Thanks to MarkWhile I am doing the same problem

  1. Sometimes eclipse will add spring 2.5 jar from local/.m2Delete it from build path, or even you add spring 4.1, it will still use spring 2.5

2 You should have spring orm dependency in you Maven-dependencyadd this to pom.xml

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


Hibernate 4 support was added to Spring Framework in 3.1.

Your pom.xml references Spring Framework 2.5.6 hence org.springframework.orm.hibernate4.LocalSessionFactoryBean does not exist. You need to update your pom.xml to reference Spring Framework 3.1 or later.


Here's the new pom.xml containing spring 3.1.1:

  <!-- Spring 3 dependencies -->  <dependency>  <groupId>org.springframework</groupId>  <artifactId>spring-core</artifactId>   <version>${spring.version}</version></dependency>  <dependency>  <groupId>org.springframework</groupId>   <artifactId>spring-context</artifactId>    <version>${spring.version}</version>  </dependency>  <dependency>  <groupId>org.springframework</groupId>  <artifactId>spring-web</artifactId>   <version>${spring.version}</version>  </dependency> <dependency>  <groupId>org.springframework</groupId>   <artifactId>spring-tx</artifactId>    <version>${spring.version}</version>   </dependency> <dependency>  <groupId>org.springframework</groupId>  <artifactId>spring-orm</artifactId> <version>${spring.version}</version> </dependency>  <dependency>        <groupId>org.springframework</groupId>        <artifactId>spring-test</artifactId>        <version>${spring.version}</version>    </dependency>