bug解決:org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 6; 不允許有匹配 "[xX][mM][lL]" 的處理指令目標。

  1. Caused by: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 6; 不允許有匹配 "[xX][mM][lL]" 的處理指令目標。
  2. at [圖片]com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
  3. at [圖片]com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
  4. at [圖片]com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
  5. at [圖片]com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
  6. at [圖片]com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
  7. at [圖片]com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPIData(Unknown Source)
  8. at [圖片]com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanPIData(Unknown Source)
  9. at [圖片]com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPI(Unknown Source)
  10. at [圖片]com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
  11. at [圖片]com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
  12. at [圖片]com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
  13. at [圖片]com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
  14. at [圖片]com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
  15. at [圖片]com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
  16. at [圖片]com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
  17. at [圖片]com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
  18. at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:251)
  19. ... 31 more

這兩天在整合mybatis項目時,遇到了這個問題,後來查了資料才發現原來如此。

問題:xml文件的第一行不允許有空格或是空行

問題解決 :

查看了項目的所有xml文件,發現spring-mybatis.xml 配置文件的首行是空的,刪除該行即可(確保xml的第一句<?xml version="1.0" encoding="UTF-8"?>之前沒有空格或空行即可)

發佈了103 篇原創文章 · 獲贊 25 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章