当前位置: 代码迷 >> 应用服务器 >> 做ibatis测试时报的异常 请帮小弟我看一下
  详细解决方案

做ibatis测试时报的异常 请帮小弟我看一下

热度:8326   发布时间:2013-02-26 00:00:00.0
做ibatis测试时报的错误 请帮我看一下
Exception in thread "main" java.lang.ExceptionInInitializerError
at bonc.Main.main(Main.java:15)
Caused by: java.lang.RuntimeException: Error occurred. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: org.xml.sax.SAXParseException: Document root element "sqlMapConfig", must match DOCTYPE root "sqlMap".
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:89)
at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:63)
at bonc.Myibatis.<clinit>(Myibatis.java:18)
... 1 more
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: org.xml.sax.SAXParseException: Document root element "sqlMapConfig", must match DOCTYPE root "sqlMap".
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53)
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:86)
... 3 more
Caused by: org.xml.sax.SAXParseException: Document root element "sqlMapConfig", must match DOCTYPE root "sqlMap".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
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.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
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.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at com.ibatis.common.xml.NodeletParser.createDocument(NodeletParser.java:157)
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:50)
... 4 more

------解决方案--------------------------------------------------------
很明显是ibatis解析配置文件的时候出错,对照ibatis官方的例子,重新检查你配置文件的格式吧
  相关解决方案