IDE/Spring

[Spring/Error] sqlSessionFactory 오류

Ma_Sand 2022. 7. 19. 22:49
반응형
ERROR: org.springframework.web.context.ContextLoader - Context initialization failed 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 mapping resource: 'file [C:\webapps\Spring\WEB-INF\classes\mappers\member-mapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'alias'. Cause: java.lang.ClassNotFoundException: Cannot find class: 

 

 

회원가입에서 이메일 인증 구현 후 테스트하다가 이메일이 계속 느리게 와서 clean을 반복했다.

그러다가 잘 실행되던 게 갑자기 위의 오류가 발생했다.

 

 

해결 방법은 이렇다.

 

 

root-context.xml 에서

 

<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">

    <property name="configLocation" value="classpath:mybatis-config.xml"/>

    <property name="dataSource" ref="dataSource"/>

</bean>

 

저 classpath 옆에 *을 붙이면 된다.

이렇게..

 

 

변경 후 실행해본다.

 

만약에 변경했는데도 안된다면 다시 원래대로 *을 뺀 후 실행시키면 된다.

 

 

 

++) classpath 뒤에 *을 추가했다가 삭제해도 계속 안되다가 한 10~20분 지나니까 알아서 잘 실행됐다...

반응형