ibatis项目启动报错The string "--" is not permitted within comments原
Posted whatlonelytear
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ibatis项目启动报错The string "--" is not permitted within comments原相关的知识,希望对你有一定的参考价值。
该错误主要就是因为xml中<!-- 【注释】--> 注释与-->之间没有空格造成xml解析错误
sqlMapConfig.xml内容如下
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN" "http://www.ibatis.com/dtd/sql-map-config-2.dtd"> <sqlMapConfig> <settings cacheModelsEnabled="true" enhancementEnabled="true" lazyLoadingEnabled="true" errorTracingEnabled="true" maxRequests="100" maxSessions="100" maxTransactions="100" useStatementNamespaces="true"/> <!-- 老师 --> <sqlMap resource="com/test/edu/sqlmap/sqlmap-teacher.xml"/> <!-- 学生 --> <sqlMap resource="com/test/edu/sqlmap/sqlmap-student.xml"/> </sqlMapConfig>
而sqlmap-student.xml内容如下
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <sqlMap> <!-- 统计学生--> <select id="countStudent" parameterClass="com.test.edu.Student" resultClass="com.test.edu.Student"> select * from tbl_student where id = ‘1‘; </select> </sqlMap>
问题就出在"统计学生"附近 , 仔细看会发现统计学生和-->之间没有空格。
以上是关于ibatis项目启动报错The string "--" is not permitted within comments原的主要内容,如果未能解决你的问题,请参考以下文章
记录一些遇见的bug——项目启动报错org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.e
ibatis动态sql配置启动时提示:The content of elements must consist of well-formed character data...
eclipse:项目启动MySQL报错:The last packet successfully received from the server was x milliseconds ago
Springboot项目启动:报错The last packet sent successfully to the server was 0 milliseconds ago