MyBatis3: Could not find SQL statement to include with refid ‘

mybatis3出现Could not find SQL statement to include with refid 异常

首先我们来分析一下ibatis这个报错信息,这段信息里包含两个重点 

         重点1:SQL statement (表明是<sql>标签包含的代码段,很不幸我就摔在这里,把sql标签写成select标签,半天找不到错误)

         重点2:with refid 'xxx'

 

原因:

1.确实没有id为“xxx”的sql代码段

        1.1 标签名写错

        1.2 id名写错了

 

2. 确实有id为“xxx”的sql代码段

        可能是代码段放置的位置有问题,被引用代码段应该放在引用的代码片段之前,我猜测原因是ibatis用的是sax解析的缘故,没仔细研究过源码,纯属猜测。

猜你喜欢

转载自andinker.iteye.com/blog/2407602