maven build的時候出現報錯: Caused by: org.xml.sax.SAXParseException;
阿新 • • 發佈:2018-12-24
maven build的時候出現報錯:
Caused by: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 16; 文件根元素 “configuration” 必須匹配 DOCTYPE 根 “mapper”。
出現錯誤原因:
mybatis的SqlmapConfig配置檔案資訊沒有不正確:
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <plugins> <!-- com.github.pagehelper 為 PageHelper 類所在包名 --> <plugin interceptor="com.github.pagehelper.PageHelper"> <!-- 設定資料庫型別 Oracle,Mysql,MariaDB,SQLite,Hsqldb,PostgreSQL 六種資料庫--> <property name="dialect" value="mysql"/> </plugin> </plugins> </configuration>
修改方法:
將SqlMapConfig檔案的頭資訊修改如下:
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <plugins> <!-- com.github.pagehelper 為 PageHelper 類所在包名 --> <plugin interceptor="com.github.pagehelper.PageHelper"> <!-- 設定資料庫型別 Oracle,Mysql,MariaDB,SQLite,Hsqldb,PostgreSQL 六種資料庫--> <property name="dialect" value="mysql"/> </plugin> </plugins> </configuration>
在SqlMapConfig.xml標頭檔案中,使用了mapper,下面的標籤就只能使用;
使用了configuration,下面的標籤就只能使用