春豆错误

更新:添加Maven依赖 * 更新:通过添加maven依赖性解决此错误*

美好的一天。 我有AplicationContext.xml的这一部分

      <!--genericdaotest/domain/Person.hbm.xml-->     org.hibernate.dialect.HSQLDialect true create       

Maven dep for spring and hibernate

   org.springframework spring-context 3.1.1.RELEASE   org.springframework spring-test 3.1.1.RELEASE   org.springframework spring-jdbc 2.0.6   org.hibernate hibernate-core 4.1.2.Final  

但是,当我启动我的应用程序时,它告诉我这个错误

 Cannot find class [org.springframework.orm.hibernate3.LocalSessionFactoryBean] for bean with name 'sessionFactory' defined in class path resource [WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.hibernate3.LocalSessionFactoryBean 

但我正在使用hibernate4。 这有什么神奇之处呢? =)我已经尝试重新部署应用程序,但结果是一样的

您错过了Spring-ORM模块:

   org.springframework spring-orm 3.1.1.RELEASE  

检查包列表 ,它包含org.springframework.orm.hibernate3包和您需要的类。

另外,我认为这个类是错误的,不应该是hibernate4.LocalSessionFactoryBean吗? 你在使用注释吗? 还是XML?

在spring应用程序上下文中更改会话工厂,以使用hibernate 4作为maven依赖状态。

org.springframework.orm.hibernate4.LocalSessionFactoryBean

并添加spring-orm依赖项