日期:2014-05-17 浏览次数:20741 次
Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Unable to read XML
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.daocao.util.db.HibernateUtil.buildSessionFactory(HibernateUtil.java:16)
at com.daocao.util.db.HibernateUtil.<clinit>(HibernateUtil.java:7)
at com.bjsxt.hibernate.Test.main(Test.java:16)
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.daocao.util.db.HibernateUtil.buildSessionFactory(HibernateUtil.java:12)
... 2 more
Caused by: org.xml.sax.SAXParseException: Element type "hibernate-mapping" must be declared.
at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1196)
at org.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLError(XMLValidator.java:1737)
at org.apache.xerces.validators.common.XMLValidator.validateElementAndAttributes(XMLValidator.java:3552)
at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1159)
at org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1806)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:949)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1081)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.util.xml.MappingReader.readMappingDocument(MappingReader.java:75)
... 13 more