黑马程序员技术交流社区

标题: 求解 [打印本页]

作者: youc3576@qq.com    时间: 2012-2-26 22:10
标题: 求解
run:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
log4j:WARN Please initialize the log4j system properly.
Initial SessionFactory creation failed.org.hibernate.MappingException: invalid configuration
Exception in thread "main" java.lang.ExceptionInInitializerError
        at cn.micblog.utils.HibernateUtil.<clinit>(HibernateUtil.java:28)
        at cn.micblog.test.DBTest.main(DBTest.java:20)
Caused by: org.hibernate.MappingException: invalid configuration
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1521)
        at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:1035)
        at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:64)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
        at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:1017)
        at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:64)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1448)
        at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:1011)
        at cn.micblog.utils.HibernateUtil.<clinit>(HibernateUtil.java:24)
        ... 1 more
Caused by: org.xml.sax.SAXParseException: The content of element type "session-factory" must match "(property*,mapping*,(class-cache|collection-cache)*,event*,listener*)".
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2017)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:901)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
        at org.dom4j.io.SAXReader.read(SAXReader.java:465)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1518)
        ... 9 more
Java Result: 1
成功生成(总时间:2 秒)

作者: 李晓俊老师    时间: 2012-2-26 22:23
啥玩意啊
作者: dangfei    时间: 2012-2-27 11:01
在HibernateUtil.java第24行报错,应该是你Hibernate相关配置文件出错,你把配置贴出来看看呗。




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2