- Caused by: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 6; 不允许有匹配 "[xX][mM][lL]" 的处理指令目标。
- at [图片]com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
- at [图片]com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(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.XMLScanner.reportFatalError(Unknown Source)
- at [图片]com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPIData(Unknown Source)
- at [图片]com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanPIData(Unknown Source)
- at [图片]com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPI(Unknown Source)
- at [图片]com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
- at [图片]com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(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 org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:251)
- ... 31 more
这两天在整合mybatis项目时,遇到了这个问题,后来查了资料才发现原来如此。
问题:xml文件的第一行不允许有空格或是空行
问题解决 :
查看了项目的所有xml文件,发现spring-mybatis.xml 配置文件的首行是空的,删除该行即可(确保xml的第一句<?xml version="1.0" encoding="UTF-8"?>之前没有空格或空行即可)
- Caused by: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 6; 不允许有匹配 "[xX][mM][lL]" 的处理指令目标。
- at [图片]com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
- at [图片]com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(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.XMLScanner.reportFatalError(Unknown Source)
- at [图片]com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPIData(Unknown Source)
- at [图片]com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanPIData(Unknown Source)
- at [图片]com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPI(Unknown Source)
- at [图片]com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
- at [图片]com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(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 org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:251)
- ... 31 more
来源:CSDN
作者:冬日下的暖阳
链接:https://blog.csdn.net/dsl59741/article/details/103790712