当前位置: 代码迷 >> Java相关 >> Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml],该如何解决
  详细解决方案

Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml],该如何解决

热度:9450   发布时间:2013-02-25 21:45:40.0
Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]
我用struts1.1+spring2.0+hibernate3.0+ehcache1.3在没有配置ehcache前,都没有问题,程序能正常运行,但加上ehcache的配置后,启动tomcat就报错:

2008-05-07 03:02:33 StandardContext[/testhbn]action: null
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.InvalidMappingException: Could not parse mapping document from invalid mapping
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from invalid mapping
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:508)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:651)

不知道是什么原因?请帮我找找原因,先谢了。

------解决方案--------------------------------------------------------
看着像
<value>com/suntravel/sunes/user/User.hbm.xml </value>
有问题,User.hbm.xml文件没什么问题吧
------解决方案--------------------------------------------------------
可能是包冲突问题,把hibernate-annotations.jar删掉试试看?
------解决方案--------------------------------------------------------
学习一下!
------解决方案--------------------------------------------------------
同意包冲突

看看 asm.jar asm-attrs.jar cglib-2.1.3.jar commons-cllections-2.1.1.jar 是否有重复的包, 如果有删除上述重复的
------解决方案--------------------------------------------------------
学习了,刚遇到了这问题。我想也是包冲突的问题。删包试试看
------解决方案--------------------------------------------------------
如果是包重复了,它不会覆盖???
  相关解决方案