ssh整合时可能会遇到很多问题,常见的问题之一
报如下错误:
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: entity class not found: Customer
org.hibernate.MappingException: entity class not found
可能原因:若持久化类为:User.java
对应的hibernate映射文件为:User.hbm.xml
一般系统自动生成的映射文件为:
<hibernate-mapping>
<class name="User" table="......
要将class路径改为绝对路径。若User.java在包com.ssh.bean下,则要改为<class name="com.ssh.bean.User" ......>