본문 바로가기

IT개발정보/spring and java

[error] Error creating bean with name 'sqlSessionFactory'

오류 :  Error creating bean with name 'sqlSessionFactory'

ERROR: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in ServletContext resource 
[/WEB-INF/spring/root-context.xml]: Initialization of bean failed; 
nested exception is org.springframework.beans.TypeMismatchException:
Failed to convert property value of type 'java.lang.String' to required type
'org.springframework.core.io.Resource[]' for property 'mapperLocations'; 
nested exception is java.lang.IllegalArgumentException: 
Could not resolve resource location pattern [classpath:/sqlmap/*/_SQL.xml]:
class path resource [sqlmap/] cannot be resolved to URL because it does not exist

 

해결

클래스패스 자료들이 [classpath:/sqlmap/**/*_SQL.xml] URL에 존재하지 않는다는 에러로서 [classpath*:/sqlmap/**/*_SQL.xml]로 *을 추가하여 복수개의 파일을 전부 찾아주면 에러가 발생하지 않는다.