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

前端 未结 3 2075
隐瞒了意图╮
隐瞒了意图╮ 2021-01-05 01:15

I\'m new to Spring this is my first example (JSF 2, PrimeFaces 3, Spring & Hibernate Integration) here\'s the pom.xml :



        
相关标签:
3条回答
  • 2021-01-05 02:02

    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>
    
    0 讨论(0)
  • 2021-01-05 02:04

    Thanks to Mark While I am doing the same problem

    1. Sometimes eclipse will add spring 2.5 jar from local/.m2 Delete 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-dependency add this to pom.xml

     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-orm</artifactId>
       <version>4.1.6.RELEASE</version>
    </dependency>
    
    0 讨论(0)
  • 2021-01-05 02:10

    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.

    0 讨论(0)
提交回复
热议问题