当hibernate配置文件未带此类信息时
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
报
Document is invalid: no grammar found.
详细的异常栈如下
org.hibernate.MappingException: invalid configuration
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1579)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1520)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1506)
at HibernateUtils.<clinit>(HibernateUtils.java:16)
at HibernateTest.main(HibernateTest.java:9)
Caused by: org.xml.sax.SAXParseException: Document is invalid: no grammar found.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown So
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootEle
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Sou
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1576)
... 4 more
Exception in thread "main" java.lang.ExceptionInInitializerError
at HibernateUtils.<clinit>(HibernateUtils.java:21)
at HibernateTest.main(HibernateTest.java:9)
Caused by: org.hibernate.MappingException: invalid configuration
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1579)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1520)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1506)
at HibernateUtils.<clinit>(HibernateUtils.java:16)
... 1 more
Caused by: org.xml.sax.SAXParseException: Document is invalid: no grammar found.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown So
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootEle
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Sou
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1576)
... 4 more
分享到:
相关推荐
面对Spring、Hibernate、Struts框架中的错误,开发者应仔细检查配置文件、类路径设置、数据库连接信息等,同时利用日志记录和异常处理机制来追踪和分析问题。通过上述步骤,可以有效地诊断和解决大部分常见的技术...
1. `etc`:这个目录通常包含配置文件,如`hibernate.cfg.xml`,它是Hibernate的主配置文件,用于定义数据库连接信息、缓存策略等。 2. `grammar`:这部分包含了Hibernate的SQL解析器,是Hibernate对特定数据库方言...
English Grammar Today.iso English Grammar Today 下载 English Grammar Today.iso English Grammar Today 下载
2. **grammar**:此目录下的文件可能是Hibernate的词法和语法分析文件,它们涉及到Hibernate的查询语言HQL(Hibernate Query Language)和Criteria API的解析规则。深入研究这部分源码,可以理解如何构建和执行复杂...
9下Unit2Grammar课件.ppt
7Aunit1Grammar课件.ppt
7AUnit1Thisisme!Grammar课件.ppt
[剑桥高级英语语法书第二版].Cambridge.Advanced.Grammar.in.Use.[2nd.edition.2005].pdf part 2 of 3
牛津译林版英语八上8上3单元Grammar教案.pdf
在提供的文档"output right linear regular grammar.doc"中,很可能是详细介绍了如何使用C++进行这些操作的步骤,包括代码示例和可能的算法描述。文档可能会涵盖如何读取文法规则,构建解析树,以及如何进行语法分析...
Data.Mining.Using.Grammar.Based.Genetic.Programming.And.Applications[2002]
【标题】: 八年级英语下册Unit5GoodmannersP3Grammar课件.ppt 【描述】: 本课件主要围绕八年级下册第五单元"Good Manners"的第三部分语法展开,旨在帮助学生掌握如何正确使用"enough to"和"too...to"这两个结构,并...
“ansi.c.grammar.y”文件则是ANSI-C的语法分析规则,它用Bison(yacc的现代版本)语法描述了C语言的语法规则。这些规则包括声明、表达式、控制结构等,通过递归下降解析(recursive descent parsing)的方式,构建...
在英语语法中,特殊疑问句(Special Questions)是一种用来询问具体信息的句型,与一般疑问句不同,它不以“yes”或“no”来回答。特殊疑问句由一个特殊疑问词(如what, who, which, whom, whose, when, how, why, ...
[剑桥高级英语语法书第二版].Cambridge.Advanced.Grammar.in.Use.[2nd.edition.2005].pdf part 3 of 3
在给定的文件中,我们看到同位语从句被广泛讨论,并通过各种例子来说明其用法。 同位语从句通常紧跟在某些特定的名词后面,这些名词包括但不限于 fact, thought, news, doubt, suggestion, idea, question, plan, ...
在7A Unit 2 Grammar课件中,它主要通过一系列例子和练习来教授这一概念。 1. **构成规则:** - 对于第一人称单数(I)、第二人称单数(you)以及所有复数主语,动词保持原形。例如:“I like red.”(我喜欢红色...