且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applica

更新时间:2021-12-11 06:25:23



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 java.io.FileNotFoundException: class path resource [com/app/server/bean/Customer.hbm.xml] cannot be opened because it does not exist


异常说找不到这个资源[com/app/server/bean/Customer.hbm.xml]

1,因为在配置文件里并没有使用和配置这个资源,所以是缓存问题,在我把服务器删除重建之后,重启服务器就好了。

2,如果在配置文件里配置了这个资源,请检查一下hibernate映射路径是否正确。

3,如果配置路径也正确,请检查一下jar包,是否有冲突,用rar打开hibernate3.jar,里面已经包含annotations相关包,与老版冲突。

     解决的方法:将lib目录下的:hibernate-annotations.jar和hibernate-commons-annotations.jar删除后重新部署即可。