java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath () Ljava / lang / String;
У меня возникла проблема с egovframework of Korea, когда я развернул файловую войну Tomcat после перезапуска Tomcat, она показала ошибку, как показано ниже:
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) ....................................................
Я использовал :
[[email protected] 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)
Вот файл WEB-INF / web.xml
- log4j: WARN Для журнала в web.xml не найдено никаких добавлений.
- Spring MVC: разница между тегами и ?
- Пользовательский менеджер проверки подлинности с функцией Spring Security и Java Configuration
- Как вручную установить аутентифицированного пользователя в Spring Security / SpringMVC
- сеансы загрузки исключений из постоянного хранилища
spring security encodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding utf-8 encodingFilter *.do encodingFilter *.mdo HTMLTagFilter egovframework.com.cmm.filter.HTMLTagFilter HTMLTagFilter *.do <!-- LoginPolicyFilter egovframework.com.uat.uap.filter.EgovLoginPolicyFilter LoginPolicyFilter /uat/uia/actionLogin.do --> contextConfigLocation classpath*:egovframework/spring/com/context-*.xml org.springframework.web.context.ContextLoaderListener action org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/config/egovframework/springmvc/egov-com-*.xml 1 action *.do springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* org.springframework.security.ui.session.HttpSessionEventPublisher EgovSpringSecurityLogoutFilter egovframework.com.sec.security.filter.EgovSpringSecurityLogoutFilter EgovSpringSecurityLogoutFilter /uat/uia/actionLogout.do EgovSpringSecurityLoginFilter egovframework.com.sec.security.filter.EgovSpringSecurityLoginFilter 로그인 실패시 반활 될 URL설정 loginURL /uat/uia/egovLoginUsr.do EgovSpringSecurityLoginFilter *.do <!-- EgovSSOLogoutFilter egovframework.com.uat.sso.filter.EgovSSOLogoutFilter SSO Global Logout 처리후 반환되는 페이지 설정 returnURL /j_spring_security_logout EgovSSOLogoutFilter /uat/uia/actionLogout.do --> <!-- EgovSSOLoginFilter egovframework.com.uat.sso.filter.EgovSSOLoginFilter EgovSSOLoginFilter *.do --> ajaxServlet net.sourceforge.ajaxtags.servlets.SourceLoader prefix /ajaxtags ajaxServlet /ajaxtags/js/* ajaxServlet /ajaxtags/img/* ajaxServlet /ajaxtags/css/* index.jsp egovDevIndex.jsp BASIC 600 404 /code404.jsp 500 /code500.jsp
в системуspring security encodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding utf-8 encodingFilter *.do encodingFilter *.mdo HTMLTagFilter egovframework.com.cmm.filter.HTMLTagFilter HTMLTagFilter *.do <!-- LoginPolicyFilter egovframework.com.uat.uap.filter.EgovLoginPolicyFilter LoginPolicyFilter /uat/uia/actionLogin.do --> contextConfigLocation classpath*:egovframework/spring/com/context-*.xml org.springframework.web.context.ContextLoaderListener action org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/config/egovframework/springmvc/egov-com-*.xml 1 action *.do springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* org.springframework.security.ui.session.HttpSessionEventPublisher EgovSpringSecurityLogoutFilter egovframework.com.sec.security.filter.EgovSpringSecurityLogoutFilter EgovSpringSecurityLogoutFilter /uat/uia/actionLogout.do EgovSpringSecurityLoginFilter egovframework.com.sec.security.filter.EgovSpringSecurityLoginFilter 로그인 실패시 반활 될 URL설정 loginURL /uat/uia/egovLoginUsr.do EgovSpringSecurityLoginFilter *.do <!-- EgovSSOLogoutFilter egovframework.com.uat.sso.filter.EgovSSOLogoutFilter SSO Global Logout 처리후 반환되는 페이지 설정 returnURL /j_spring_security_logout EgovSSOLogoutFilter /uat/uia/actionLogout.do --> <!-- EgovSSOLoginFilter egovframework.com.uat.sso.filter.EgovSSOLoginFilter EgovSSOLoginFilter *.do --> ajaxServlet net.sourceforge.ajaxtags.servlets.SourceLoader prefix /ajaxtags ajaxServlet /ajaxtags/js/* ajaxServlet /ajaxtags/img/* ajaxServlet /ajaxtags/css/* index.jsp egovDevIndex.jsp BASIC 600 404 /code404.jsp 500 /code500.jsp
-spring security encodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding utf-8 encodingFilter *.do encodingFilter *.mdo HTMLTagFilter egovframework.com.cmm.filter.HTMLTagFilter HTMLTagFilter *.do <!-- LoginPolicyFilter egovframework.com.uat.uap.filter.EgovLoginPolicyFilter LoginPolicyFilter /uat/uia/actionLogin.do --> contextConfigLocation classpath*:egovframework/spring/com/context-*.xml org.springframework.web.context.ContextLoaderListener action org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/config/egovframework/springmvc/egov-com-*.xml 1 action *.do springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* org.springframework.security.ui.session.HttpSessionEventPublisher EgovSpringSecurityLogoutFilter egovframework.com.sec.security.filter.EgovSpringSecurityLogoutFilter EgovSpringSecurityLogoutFilter /uat/uia/actionLogout.do EgovSpringSecurityLoginFilter egovframework.com.sec.security.filter.EgovSpringSecurityLoginFilter 로그인 실패시 반활 될 URL설정 loginURL /uat/uia/egovLoginUsr.do EgovSpringSecurityLoginFilter *.do <!-- EgovSSOLogoutFilter egovframework.com.uat.sso.filter.EgovSSOLogoutFilter SSO Global Logout 처리후 반환되는 페이지 설정 returnURL /j_spring_security_logout EgovSSOLogoutFilter /uat/uia/actionLogout.do --> <!-- EgovSSOLoginFilter egovframework.com.uat.sso.filter.EgovSSOLoginFilter EgovSSOLoginFilter *.do --> ajaxServlet net.sourceforge.ajaxtags.servlets.SourceLoader prefix /ajaxtags ajaxServlet /ajaxtags/js/* ajaxServlet /ajaxtags/img/* ajaxServlet /ajaxtags/css/* index.jsp egovDevIndex.jsp BASIC 600 404 /code404.jsp 500 /code500.jsp
Вот /WEB-INF/config/egovframework/springmvc/egov-com-servlet.xml
<!-- --> <!-- /**/*.do --> <!-- --> <!-- /uat/uia/[a-zA-Z]+\.do /EgovLeft.do /uat/uia/actionLogin.do --> egovframework/com/cmm/error/dataAccessFailure egovframework/com/cmm/error/dataAccessFailure egovframework/com/cmm/error/egovBizException egovframework/com/uat/uia/EgovLoginUsr <!-- -->
Пожалуйста, помогите мне, спасибо
- Являются ли Spring MVC Controllers Singletons?
- Возврат JsonObject с помощью @ResponseBody в SpringMVC
- Можно ли настроить SpringMVC для обработки всех запросов, но исключить каталоги статического содержимого?
- 404 перенаправляет ошибку Spring с помощью java config
- Почему DispatcherServlet создает другой контекст приложения?
- Как включить js и CSS в JSP с помощью Spring MVC
- Кто устанавливает тип содержимого ответа в Spring MVC (@ResponseBody)
- как установить заголовок без кэша весной mvc 3 по annotations
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath () Ljava / lang / String;
Этот метод был добавлен в Servlet 2.5 .
Таким образом, эта проблема может иметь как минимум 3 причины:
- Контейнер сервлета не поддерживает Servlet 2.5.
-
web.xml
не объявлен совместимым с Servlet 2.5 или новее. - Путь к classам времени выполнения Webapp усеяна определенными JAR-файлами с сервлетами контейнера make / version другого сервлета, который не поддерживает Servlet 2.5.
Чтобы решить эту проблему,
- Убедитесь, что ваш контейнер сервлета поддерживает как минимум Servlet 2.5. Это, по крайней мере, Tomcat 6, Glassfish 2, JBoss AS 4.1 и т. Д. Например, Tomcat 5.5 поддерживает на самом высоком сервлета 2.4. Если вы не можете обновить Tomcat, вам нужно будет понизить Spring до версии, совместимой с Servlet 2.4.
- Убедитесь, что корневое объявление
web.xml
соответствует Servlet 2.5 (или новее, по крайней мере, наивысшему, что поддерживает ваша целевая среда выполнения). Например, см. Также где-то наполовину нашу страницу wiki сервлета . - Удостоверьтесь, что у вас нет каких-либо специфических библиотек
servlet-api.jar
таких какservlet-api.jar
илиj2ee.jar
in/WEB-INF/lib
или, что еще хуже,JRE/lib
илиJRE/lib/ext
. Они там не принадлежат. Это довольно распространенная ошибка начинающего пользователя в попытке обойти ошибки компиляции в среде IDE, см. Также Как импортировать API javax.servlet в проект Eclipse? ,