로컬에서는 잘 실행되는 프로젝트가 호스팅 서버에 올리니까 오류가 뜨고 실행이 안 됐다.
로그를 보니 아래와 같이 오류가 떠서 root-context 파일부터 에러 뜨는 클래스, 파일 경로까지 확인했지만 도저히 문제를 못 찾았다.
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 [/yyj1999/tomcat/webapps/ROOT/WEB-INF/classes/mappers/RoomMapper.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 'roomPayVO'.
Cause: java.lang.ClassNotFoundException: Cannot find class: roomPayVO
mapper에서 resultType으로 작성한 클래스를 못 찾는 것 같아 root-context.xml 파일에 아래와 같이 패키지를 등록했지만 여전히 해결되지 않았다.

내 경우는 컴파일 버전이 맞지 않아 생기는 오류였다ㅜㅜ 로컬에선 11로 실행했는데 호스팅 서버에서는 JDK8을 사용한다고 되어있었다. 프로젝트 컴파일 레벨을 1.8로 변경후 다시 war파일 배포 후 실행하니 잘 되었다.
참조
스프링 오류 - Could not resolve type alias '패키지명.클래스명'
스프링 오류오류 메시지 상세 내용 중 일부(예시)ERROR: org.springframework.web.context.ContextLoader - Context initialization failedorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory'
stajun.tistory.com
https://limeeyojung.tistory.com/22
[tomcat] Could not resolve type alias, Cannot find class 톰캣 에러
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias '클래스 ALIAS명'. Cause: java.lang.ClassNotFoundException: Cannot find class: 클래스명 mybatis typealias 사용중인 프로젝트가 톰캣 구동시 갑자기 위와
limeeyojung.tistory.com
'1. 프로그래밍 > 오류' 카테고리의 다른 글
java.util.zip.ZipException: error in opening zip file 에러 (0) | 2023.01.31 |
---|---|
톰캣이 프로젝트 인식을 못할 때 (0) | 2023.01.25 |
STS EXC_CRASH (SIGKILL (Code Signature Invalid)) 에러 (0) | 2023.01.13 |
java build path maven dependencies 오류 (0) | 2022.07.26 |
Deployment Assembly 오류 (0) | 2022.07.12 |