`

ibatis查询错误:Could not set result class.

    博客分类:
  • J2EE
阅读更多
用ibatis做查询,遇到这样的错误:
Exception in thread "main" java.lang.ExceptionInInitializerError
	at com.ccutsesms.mis.service.QueryThesisService.<clinit>(QueryThesisService.java:13)
	at test.com.ccutsesms.mis.util.TestQueryThesis.testGetAll(TestQueryThesis.java:49)
	at test.com.ccutsesms.mis.util.TestQueryThesis.main(TestQueryThesis.java:61)
Caused by: java.lang.RuntimeException: Could not initialize DaoConfig.
Cause: com.ibatis.dao.client.DaoException: Error while configuring DaoManager.  Cause: com.ibatis.common.exception.NestedRuntimeException: Error occurred.  Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'.  Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMap/select'.  Cause: com.ibatis.sqlmap.client.SqlMapException: Error.  Could not set result class.  Cause: java.lang.ClassNotFoundException: Record.recordMap
Caused by: java.lang.ClassNotFoundException: Record.recordMap
Caused by: com.ibatis.sqlmap.client.SqlMapException: Error.  Could not set result class.  Cause: java.lang.ClassNotFoundException: Record.recordMap
Caused by: java.lang.ClassNotFoundException: Record.recordMap
Caused by: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMap/select'.  Cause: com.ibatis.sqlmap.client.SqlMapException: Error.  Could not set result class.  Cause: java.lang.ClassNotFoundException: Record.recordMap
Caused by: java.lang.ClassNotFoundException: Record.recordMap
Caused by: com.ibatis.sqlmap.client.SqlMapException: Error.  Could not set result class.  Cause: java.lang.ClassNotFoundException: Record.recordMap
Caused by: java.lang.ClassNotFoundException: Record.recordMap
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMap/select'.  Cause: com.ibatis.sqlmap.client.SqlMapException: Error.  Could not set result class.  Cause: java.lang.ClassNotFoundException: Record.recordMap
Caused by: java.lang.ClassNotFoundException: Record.recordMap
......

查了好久,最后发现是配置文件写错了!
<select id="getAllQueryThesises" resultClass="Record.recordMap">
    	SELECT 
    		id,
    		ptid,
    		queryItem,
    		queryNum,
    		queryTime
    	FROM ThesisQuery ORDER BY id
    </select>


将其中的resultClass改为resultMap,错误就没有了!
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics