Caused by: org.hibernate.InvalidMappingException: Unable to read XML
at org.hibernate.util.xml.MappingReader.readMappingDocument(MappingReader.java:101)
at org.hibernate.cfg.Configuration.add(Configuration.java:513)
at org.hibernate.cfg.Configuration.add(Configuration.java:509)
at org.hibernate.cfg.Configuration.add(Configuration.java:716)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:801)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:2344)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:2310)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2290)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2243)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2158)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2137)
at com.pear.zcp.Util.HirFactory.<clinit>(HirFactory.java:11)
... 24 more
Caused by: org.dom4j.DocumentException: Error on line 10 of document : Element type "property" must be followed by either attribute specifications, ">" or "/>". Nested exception: Element type "property" must be followed by either attribute specifications, ">" or "/>".
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.hibernate.util.xml.MappingReader.readMappingDocument(MappingReader.java:75)
... 35 more
一开始以为是标签有用错的地方,是否没有闭合。检查没有问题。 又检查映射关系是否正确。检查也没有问题。 最后在一个标签处发现。标签没有自动提示属性等信息。标签里可能含有隐藏的xml无法解析的字符。删掉标签重新写之后。就没有在报错了。错误比较隐秘。