mybaites mapper bean 创建失败: SAXParseException: The content of elements must consist of well-formed

 存在问题的sql语句代码: 

@Select({
            ""
    })
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.(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中不能直接使用'>' 或'<' 要用 '<' 或 '>' 替代后, 异常解决mybaites mapper bean 创建失败: SAXParseException: The content of elements must consist of well-formed_第1张图片

你可能感兴趣的:(日常,java)