문제 발생
심각: Error configuring application listener of class org.springframework.web.context.ContextLoaderListenerjava.lang.
프로젝트를 새로 만들어서 진행해야하는 일이 있어서 Spring mvc 로 maven 프로젝트를 생성했다.
프로젝트 실행 테스트겸 서버에 올려 실행시켰더니 위와 같은 에러가 발생했다.
인터넷에 돌아다니는 가장 보편적인 해결방법으로는
프로젝트 >> properties >> Deployment Assembly를 선택한 후, "Add" >> Java Build Path Entries >> Maven Dependencies 선택한 후, "Apply"를 해준다.
|
였다.
하지만 위와 같은 방법을 통해 해결을 한 뒤, maven update를 다시 진행시키면 maven dependencies가 사라졌다.
이는 임시방편일 뿐 해결책은 아니라고 판단해 다른 방법을 찾았다.
문제점 발견
이 오류는 maven의 dependency가 정상적으로 처리되지 못한 경우 tomcat의 server plugin의 임시 deploy 디렉토리에 WEB-INF/lib에 jar들이 정상적으로 배포되지 않았기 때문에 발생한 오류라고 한다.
해결 방법
프로젝트 바로 아래에 있는 .classpath 파일에 다음 내용을 추가시켜줘야 한다.
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
그 이후 maven update를 진행해도 maven dependencies를 재등록해야하는 일이 발생되지 않았다.
'개발 > Java' 카테고리의 다른 글
[Java] Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources failed (0) | 2021.11.03 |
---|---|
[Java] Unable to locate executable for jre1.8.0_291 (0) | 2021.10.25 |
댓글