본문 바로가기

Spring

[Error] - java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for

728x90

Mybatis의 DAO와 XML 파일을 매핑해주는 과정에서 오류가 발생하였다.

 

심각: Servlet.service() for servlet [action] in context with path [/myweb2] threw exception [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 (DAO메서드명)

### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for (DAO메서드명) ] with root cause

java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for (DAO메서드명)

 

다음과 같은 에러가 나는 이유는 XML파일이 잘못되었거나 혹은 DAO가 잘못되었기 때문이다.

 

(1) mapper id가 틀린 경우

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

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

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

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

 

나의 경우는 DAO 에서 올바르지 못한 namespace를 지정해주었기 때문에 오류가 발생하였었다.

 

 

일치시켜주었더니 정상작동하였다.