java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?

MessageTag - No WebApplicationContext found: no ContextLoaderListener registered?
java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
    at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:84)
    at org.springframework.web.servlet.support.RequestContextUtils.getWebApplicationContext(RequestContextUtils.java:81)
    at org.springframework.web.servlet.support.RequestContext.initContext(RequestContext.java:219)
    at org.springframework.web.servlet.support.JspAwareRequestContext.initContext(JspAwareRequestContext.java:74)
    at org.springframework.web.servlet.support.JspAwareRequestContext.<init>(JspAwareRequestContext.java:48)
    at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:76)
...

 

■ 위와 같은 로그 메세지가 발생한다면 아래와 같이 web.xml에 ContextLoaderListener 리스너가 등록되어 있는지 확인하자.

<context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>classpath:spring/application-config.xml</param-value>
</context-param>

<listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

 

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다