存在问题的sql语句代码:
@Select({
"<script>",
"select file_id",
"from exampleTable ",
"where 1=1",
"<if test='condition.isMaxFileIdNotEmpty()'>",
" and mss_file_id < ${condition.maxFileId}",
"</if>",
"<if test='condition.isMinFileIdNotEmpty()'>",
" and mss_file_id > ${condition.minFileId}",
"</if>",
"<if test='condition.isFleExpiredTimeStartNotEmpty()'>",
" and file_expired_time >= ${condition.fileExpiredTimeStart}",
"</if>",
"<if test='condition.isFleExpiredTimeEndNotEmpty()'>",
" and file_expired_time <= ${condition.fileExpiredTimeEnd}",
"</if>",
"<if test='condition.isOrderByClauseNotEmpty()'>",
" ${condition.orderByClause}",
"</if>",
" LIMIT #{condition.limit} OFFSET #{condition.offset}",
"</script>"
})
aused by: java.lang.IllegalArgumentException: org.apache.ibatis.builder.BuilderException: Could not find value method on SQL annotation. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 143; The content of elements must consist of well-formed character data or markup.
at com.dianping.zebra.dao.mybatis.ZebraMapperFactoryBean.checkDaoConfig(ZebraMapperFactoryBean.java:65)
at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1753)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1690)
... 54 more
Caused by: org.apache.ibatis.builder.BuilderException: Could not find value method on SQL annotation. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 143; The content of elements must consist of well-formed character data or markup.
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.getSqlSourceFromAnnotations(MapperAnnotationBuilder.java:472)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parseStatement(MapperAnnotationBuilder.java:289)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:134)
at org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:72)
at org.apache.ibatis.session.Configuration.addMapper(Configuration.java:741)
at com.dianping.zebra.dao.mybatis.ZebraMapperFactoryBean.checkDaoConfig(ZebraMapperFactoryBean.java:62)
... 57 more
Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 143; The content of elements must consist of well-formed character data or markup.
at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:259)
at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:115)
at org.apache.ibatis.scripting.xmltags.XMLLanguageDriver.createSqlSource(XMLLanguageDriver.java:51)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.buildSqlSourceFromStrings(MapperAnnotationBuilder.java:482)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.getSqlSourceFromAnnotations(MapperAnnotationBuilder.java:465)
... 62 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 143; The content of elements must consist of well-formed character data or markup.
上述异常核心就一句话: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 143; The content of elements must consist of well-formed character data or markup.
翻译过来就是存在sql语句中使用了不合法的字符符号, 哪里不合法, 注意些特殊转义字符, mybaits中不能直接使用'>' 或'<' 要用 '<' 或 '>' 替代后, 异常解决

2471




被折叠的 条评论
为什么被折叠?



