现在的位置: 首页 > 综合 > 正文

Bug–Error creating bean with name ‘sessionFactory’ defined in class path resource [data_context.xml

2014年09月05日 ⁄ 综合 ⁄ 共 984字 ⁄ 字号 评论关闭


严重:
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 class path resource [data_context.xml]: 
Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Unable to read XML

Caused by: org.hibernate.InvalidMappingException: Unable to read XML


Caused by: org.dom4j.DocumentException: Error on line 41 of document  : 

XML document structures must start and end within the same entity. Nested exception: XML document structures must start and end within the same entity.

( XML 文档结构必须从头至尾包含在同一个实体内。 Nested exception: XML 文档结构必须从头至尾包含在同一个实体内。)

at org.dom4j.io.SAXReader.read(SAXReader.java:482)

at org.hibernate.util.xml.MappingReader.readMappingDocument(MappingReader.java:75)


描述:因为不小心动了一个实体类hibernate的映射文件,导致标签不对映出现的错误(少标签了,<hibernate-maping>没有结束标签);

控制台只告诉我创建sessionfactory出错,因为读取这个xml时节点不对映,而没告诉我到底哪个映射文件出错了,关键eclipse也不会显示红X

只好自己一个一个删除启动用排除法来找错,那个悲催~唉

抱歉!评论已关闭.