티스토리 뷰

에러메세지

Context initialized 이벤트를 [org.springframework.web.context.ContextLoaderListener] 클래스의 인스턴스인 리스너에 전송하는 동안 예외 발생
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in ServletContext resource [/WEB-INF/spring/root-context.xml]: Invocation of init method failed;

 

 

에러메세지 상세

nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is '/mappers/booklist-mapper.xml'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'Book'.  Cause: java.lang.ClassNotFoundException: Cannot find class: Book

 

 

원인

mapper파일에서 type alias 'Book' 찾지못해서 발생하는 오류

 

 

해결방법

mybatis-config.xml에서 해당 alias를 별칭으로 추가해준다

 

<typeAliases>
	<typeAlias type="com.bookforyou.bk4u.book.model.vo.Book" alias="Book"/>
</typeAliases>

나는 이미 추가되어 있는데 오류가 생겨서 프로젝트 클린했더니 다시 잘 작동했다;; 왜자꾸 이러는거야

 

반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
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
글 보관함