title: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;
body: <p>I have a problem with egovframework of Korea when I have deployed file war to Tomcat after I restarted Tomcat, it showed the error like below :</p>
  
  <pre><code>2011-12-23 09:16:01,101 ERROR [org.springframework.web.servlet.DispatcherServlet] Context initialization failed
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'imageRenderer' defined in ServletContext resource [/WEB-INF/config/egovframework/springmvc/egov-com-servlet.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
          at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
          at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
          at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
          at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442)
          at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458)
          at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339)
          at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306)
          at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
          at javax.servlet.GenericServlet.init(GenericServlet.java:212)
          at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
          at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:791)
          at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:660)
          at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
          at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
  ....................................................
  </code></pre>
  
  <p>I used : </p>
  
  <pre><code>[root@localhost bin]# java -version
  
  java version "1.6.0_20"
  OpenJDK Runtime Environment (IcedTea6 1.9.10) (rhel-1.23.1.9.10.el5_7-i386)
  OpenJDK Client VM (build 19.0-b09, mixed mode)
  </code></pre>
  
  <p>Here is file WEB-INF/web.xml</p>
  
  <pre><code>&lt;display-name&gt;spring security&lt;/display-name&gt;
      &lt;filter&gt;
          &lt;filter-name&gt;encodingFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;org.springframework.web.filter.CharacterEncodingFilter&lt;/filter-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;encoding&lt;/param-name&gt;
              &lt;param-value&gt;utf-8&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;encodingFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;encodingFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;*.mdo&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;HTMLTagFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;egovframework.com.cmm.filter.HTMLTagFilter&lt;/filter-class&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;HTMLTagFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
          &lt;!-- 0. 로그인 정책 컴포넌트용 필터 --&gt;
          &lt;!--
      &lt;filter&gt;
          &lt;filter-name&gt;LoginPolicyFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;egovframework.com.uat.uap.filter.EgovLoginPolicyFilter&lt;/filter-class&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;LoginPolicyFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/uat/uia/actionLogin.do&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
       --&gt;
          &lt;!-- Restoration from HTMLTagFilter's action (certification login) --&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;classpath*:egovframework/spring/com/context-*.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;action&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
              &lt;param-value&gt;/WEB-INF/config/egovframework/springmvc/egov-com-*.xml&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;action&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
          &lt;!-- 1. Spring Security 필터 설정--&gt;
      &lt;filter&gt;
          &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
          &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.security.ui.session.HttpSessionEventPublisher&lt;/listener-class&gt;
      &lt;/listener&gt;
  
          &lt;!-- 2. Spring Security 로그아웃 설정을 위한 필터 설정 --&gt;
          &lt;filter&gt;
          &lt;filter-name&gt;EgovSpringSecurityLogoutFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;egovframework.com.sec.security.filter.EgovSpringSecurityLogoutFilter&lt;/filter-class&gt;
          &lt;/filter&gt;
          &lt;filter-mapping&gt;
          &lt;filter-name&gt;EgovSpringSecurityLogoutFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/uat/uia/actionLogout.do&lt;/url-pattern&gt;
          &lt;/filter-mapping&gt;
  
          &lt;!-- 2. Spring Security 로그인 설정을 위한 필터 설정 --&gt;
          &lt;filter&gt;
          &lt;filter-name&gt;EgovSpringSecurityLoginFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;egovframework.com.sec.security.filter.EgovSpringSecurityLoginFilter&lt;/filter-class&gt;
                  &lt;init-param&gt;
                          &lt;description&gt;로그인 실패시 반활 될 URL설정&lt;/description&gt;
                          &lt;param-name&gt;loginURL&lt;/param-name&gt;
                          &lt;param-value&gt;/uat/uia/egovLoginUsr.do&lt;/param-value&gt;
                  &lt;/init-param&gt;
          &lt;/filter&gt;
          &lt;filter-mapping&gt;
          &lt;filter-name&gt;EgovSpringSecurityLoginFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;
          &lt;/filter-mapping&gt;
  
          &lt;!-- 3. EgovSSO 로그아웃 설정을 위한 필터 설정 --&gt;
      &lt;!--
      &lt;filter&gt;
          &lt;filter-name&gt;EgovSSOLogoutFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;egovframework.com.uat.sso.filter.EgovSSOLogoutFilter&lt;/filter-class&gt;
                  &lt;init-param&gt;
                          &lt;description&gt;SSO Global Logout 처리후 반환되는 페이지 설정&lt;/description&gt;
                          &lt;param-name&gt;returnURL&lt;/param-name&gt;
                          &lt;param-value&gt;/j_spring_security_logout&lt;/param-value&gt;
                  &lt;/init-param&gt;
          &lt;/filter&gt;
          &lt;filter-mapping&gt;
          &lt;filter-name&gt;EgovSSOLogoutFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/uat/uia/actionLogout.do&lt;/url-pattern&gt;
          &lt;/filter-mapping&gt;
          --&gt;
  
          &lt;!-- 3. EgovSSO 로그인 설정을 위한 필터 설정 --&gt;
      &lt;!--
      &lt;filter&gt;
          &lt;filter-name&gt;EgovSSOLoginFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;egovframework.com.uat.sso.filter.EgovSSOLoginFilter&lt;/filter-class&gt;
          &lt;/filter&gt;
          &lt;filter-mapping&gt;
          &lt;filter-name&gt;EgovSSOLoginFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;
          &lt;/filter-mapping&gt;
          --&gt;
  
  
      &lt;!-- AjaxTags configuration START--&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;ajaxServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;net.sourceforge.ajaxtags.servlets.SourceLoader&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;prefix&lt;/param-name&gt;
              &lt;param-value&gt;/ajaxtags&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;ajaxServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/ajaxtags/js/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;ajaxServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/ajaxtags/img/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;ajaxServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/ajaxtags/css/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
          &lt;welcome-file&gt;egovDevIndex.jsp&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
      &lt;login-config&gt;
          &lt;auth-method&gt;BASIC&lt;/auth-method&gt;
      &lt;/login-config&gt;
  
      &lt;session-config&gt;
          &lt;session-timeout&gt;600&lt;/session-timeout&gt;
      &lt;/session-config&gt;
  
      &lt;error-page&gt;
        &lt;error-code&gt;404&lt;/error-code&gt;
        &lt;location&gt;/code404.jsp&lt;/location&gt;
      &lt;/error-page&gt;
      &lt;error-page&gt;
        &lt;error-code&gt;500&lt;/error-code&gt;
        &lt;location&gt;/code500.jsp&lt;/location&gt;
      &lt;/error-page&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Here is /WEB-INF/config/egovframework/springmvc/egov-com-servlet.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!--
          수정일                 수정자                          수정내용
    =========     =======    =================================================
    2011.09.07    서준식                  로그인 체크 인터셉터 추가
    2011.09.29    이기하                  에러페이지 경로수정
  --&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
                  xmlns:aop="http://www.springframework.org/schema/aop"
                  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                                                          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
                                                          http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"&gt;
  
          &lt;!-- The controllers are autodetected POJOs labeled with the @Controller annotation. --&gt;
          &lt;context:component-scan base-package="egovframework, example"&gt;
                  &lt;context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/&gt;
                  &lt;context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service"/&gt;
                  &lt;context:exclude-filter type="annotation" expression="org.springframework.stereotype.Repository"/&gt;
          &lt;/context:component-scan&gt;
  
  
          &lt;!-- For Pagination Tag --&gt;
          &lt;bean id="imageRenderer" class="egovframework.com.cmm.ImagePaginationRenderer"/&gt;
  
          &lt;bean id="paginationManager" class="egovframework.rte.ptl.mvc.tags.ui.pagination.DefaultPaginationManager"&gt;
                  &lt;property name="rendererType"&gt;
                          &lt;map&gt;
                                  &lt;entry key="image" value-ref="imageRenderer"/&gt;
                          &lt;/map&gt;
                  &lt;/property&gt;
          &lt;/bean&gt;
  
          &lt;!--
                  - The form-based controllers within this application provide @RequestMapping
                  - annotations at the type level for path mapping URLs and @RequestMapping
                  - at the method level for request type mappings (e.g., GET and POST).
                  - In contrast, ClinicController - which is not form-based - provides
                  - @RequestMapping only at the method level for path mapping URLs.
                  -
                  - DefaultAnnotationHandlerMapping is driven by these annotations and is
                  - enabled by default with Java 5+.
          --&gt;
  
          &lt;!--
                  - This bean processes annotated handler methods, applying Application-specific PropertyEditors
                  - for request parameter binding. It overrides the default AnnotationMethodHandlerAdapter.
          --&gt;
          &lt;bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt;
                  &lt;property name="webBindingInitializer"&gt;
                          &lt;bean class="egovframework.com.cmm.web.EgovBindingInitializer"/&gt;
                  &lt;/property&gt;
                  &lt;property name="customArgumentResolvers"&gt;
                          &lt;list&gt;
                                  &lt;bean class="egovframework.rte.ptl.mvc.bind.CommandMapArgumentResolver"/&gt;
                          &lt;/list&gt;
                  &lt;/property&gt;
          &lt;/bean&gt;
  
          &lt;!-- 로그인 체크가 필요한 URL과 로그인 여부를 체크해줄 인터셉터를 등록한다. --&gt;
          &lt;!--
          &lt;bean id="selectAnnotaionMapper" class="egovframework.rte.ptl.mvc.handler.SimpleUrlAnnotationHandlerMapping" p:order="1"&gt;
                  &lt;property name="interceptors"&gt;
                          &lt;list&gt;
                                  &lt;ref local="authenticInterceptor" /&gt;
                          &lt;/list&gt;
                  &lt;/property&gt;
                  --&gt;
                  &lt;!-- 로그인 체크가 필요한 URL 리스트  --&gt;
                  &lt;!--
                  &lt;property name="urls"&gt;
                          &lt;set&gt;
                                  &lt;value&gt;/**/*.do&lt;/value&gt;
                          &lt;/set&gt;
                  &lt;/property&gt;
          &lt;/bean&gt;
          --&gt;
  
          &lt;!-- 로그인 체크 인터셉터 --&gt;
          &lt;!-- &lt;bean id="authenticInterceptor" class="egovframework.com.cmm.interceptor.AuthenticInterceptor"&gt; --&gt;
          &lt;!-- 인증 체크가 필요 없는 URL 리스트  --&gt;
          &lt;!--
                  &lt;property name="permittedURL"&gt;
                          &lt;set&gt;
                                  &lt;value&gt;/uat/uia/[a-zA-Z]+\.do&lt;/value&gt;
                                  &lt;value&gt;/EgovLeft.do&lt;/value&gt;
                                  &lt;value&gt;/uat/uia/actionLogin.do&lt;/value&gt;
                          &lt;/set&gt;
                  &lt;/property&gt;
          &lt;/bean&gt;
          --&gt;
  
          &lt;!--
                  - This bean resolves specific types of exceptions to corresponding logical
                  - view names for error views. The default behaviour of DispatcherServlet
                  - is to propagate all exceptions to the servlet container: this will happen
                  - here with all other types of exceptions.
          --&gt;
          &lt;bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"&gt;
                  &lt;property name="defaultErrorView" value="egovframework/com/cmm/error/egovError"/&gt;
                  &lt;property name="exceptionMappings"&gt;
                          &lt;props&gt;
                                  &lt;prop key="org.springframework.dao.DataAccessException"&gt;egovframework/com/cmm/error/dataAccessFailure&lt;/prop&gt;
                                  &lt;prop key="org.springframework.transaction.TransactionException"&gt;egovframework/com/cmm/error/dataAccessFailure&lt;/prop&gt;
                                  &lt;prop key="egovframework.rte.fdl.cmmn.exception.EgovBizException"&gt;egovframework/com/cmm/error/egovBizException&lt;/prop&gt;
                                  &lt;prop key="org.springframework.web.HttpSessionRequiredException"&gt;egovframework/com/uat/uia/EgovLoginUsr&lt;/prop&gt;
                          &lt;/props&gt;
                  &lt;/property&gt;
          &lt;/bean&gt;
  
          &lt;!--
                  - This bean configures the 'prefix' and 'suffix' properties of
                  - InternalResourceViewResolver, which resolves logical view names
                  - returned by Controllers. For example, a logical view name of "vets"
                  - will be mapped to "/WEB-INF/jsp/vets.jsp".
          --&gt;
          &lt;bean class="org.springframework.web.servlet.view.UrlBasedViewResolver" p:order="1"
                    p:viewClass="org.springframework.web.servlet.view.JstlView"
                    p:prefix="/WEB-INF/jsp/" p:suffix=".jsp"/&gt;
  
          &lt;!--
                  - Message source for this context, loaded from localized "messages_xx" files.
                  - Could also reside in the root application context, as it is generic,
                  - but is currently just used within Application's web tier.
          --&gt;
          &lt;!-- &lt;bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource" p:basename="messages/message-common"/&gt; --&gt;
  &lt;/beans&gt;
  </code></pre>