티스토리 뷰

에러메세지

Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

 

 

에러메세지 상세

org.springframework.web.util.NestedServletException:
Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException:
nested exception is org.apache.ibatis.exceptions.PersistenceException:### Error querying database.
Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for booklist.selectListCount
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for booklist.selectListCount

 

원인

위와 같은 에러가 발생할 경우 아래와 같이 여러 원인이 존재할 수 있다고 한다. 

 

(1) mapper id가 틀린 경우

(2) Parameter와 bean의 field명이  틀린 경우

(3) sql.xml에서 정의된 namespace와 DAO에서 호출하는 namespace가 다를 경우

(4) mapper가 정의가 되어 있지 않거나 Spelling이 틀린 경우

(5) mapper에 정의된 namespace 명칭이 같은 Application 내에 중복 될 경우



 

해결방법

(3) sql.xml에서 정의된 namespace와 DAO에서 호출하는 namespace가 다를 경우

DAO와 mapper.xml파일의 namespace 이름을 동일하게 작성한다.

 

나의 경우는 DAO에서 작성한 namespace에 오타가 있어 mapper파일을 찾지 못하는 상황이었다.

public int selectListCount(SqlSessionTemplate sqlSession) {
	return sqlSession.selectOne("booklist.selectListCount");
}

=> booklist 가 아니라 booklistMapper 로 동일한 namespace로 고쳐주었다

반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함