개발 창고/Web

[Spring] Tomcat과 Maven의 연동에 따른 ContextLoaderListener를 찾지 못하는 문제

로이제로 2020. 9. 8. 11:12
반응형

처음 Spring을 적용해볼까 하고 시작하다 보면 다음과 같은 오류가 발생하기도 합니다.

 

  현상

영문버전에서는 아래와 같이

심각: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener

한글버전에서는 아래와 같이

심각: 클래스 [org.springframework.web.context.ContextLoaderListener]의 애플리케이션 리스터를 설정하는 중 오류 발생

발생하기도 합니다.

 

전문은 아래와 같습니다. (한글버전)

심각: 클래스 [org.springframework.web.context.ContextLoaderListener]의 애플리케이션 리스너를 설정하는 중 오류 발생
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1365)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1188)
	at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:539)
	at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:520)
	at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:150)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4602)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5139)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
	at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
	at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:738)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:342)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)

 

 

  이유

Update Project Configuration 시 Maven 라이브러리 경로가 삭제되어 발생하는 문제

 

  해결방법

1. 설정 오픈

 > eGovMobile (프로젝트) 선택 → 메뉴의 [Project] 선택 → [Properties] 선택

 또는

 > eGovMobile (프로젝트) 우클릭 → [Properties]

 또는

 > eGovMobile (프로젝트) 선택  Alt + Enter

 

eGovMobile (프로젝트) 선택 → 메뉴의 [Project] 선택  → [Properties] 선택
eGovMobile (프로젝트) 우클릭

2. Deployment Assembly [Add...] Java Build Path Entries → [Next] Maven Dependencies [Finish]

Deployment Assembly > [Add] 버튼 클릭 > Java Build Path Entries > [Next] 버튼 클릭 > Maven Dependencies 선택 > [Finish] 버튼 클릭

 

반응형