日期:2014-05-17 浏览次数:20676 次
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"这一句的最后
"http://www.hibernate.net/dtd/hibernate-mapping-3.0.dtd ">
-3.0.dtd ",dtd和"有个空格导致的dom4j解析错误.解决了这个问题后,还是出现Unable to Read XML,其实还是因为无法解析这份POJO.hbm.xml,这是因为DTD的引用地址有误,从网上找的答案来看,可以试着将上面的地址中的.net改为.org试下,应该就能成功.
"http://hibernate.sourceforge.org/hibernate-configuration-3.0.dtd">时候出现这个异常,但是改为
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">后正常
2013-12-31 13:23:47 org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
2013-12-31 13:23:47 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.4.Final}
2013-12-31 13:23:47 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
2013-12-31 13:23:47 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
2013-12-31 13:23:47 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
2013-12-31 13:23:47 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
2013-12-31 13:23:47 org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
2013-12-31 13:23:47 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: ./com/brady/model/Message.hbm.xml
Exception in thread "main" org.hibernate.InvalidMappingException: Unable to read XML
at org.hibernate.internal.util.xml.MappingReader.readMappingDocument(MappingReader.java:109)
at org.hibernate.cfg.Configuration.add(Configuration.java:478)
at org.hibernate.cfg.Configuration.add(Configuration.java:474)
at org.hibernate.cfg.Configuration.add(Configuration.java:647)