java.lang.NoSuchMethodError:javax.servlet.ServletContext.getServletRegistrations()Ljava/util/Map; [英] java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletRegistrations()Ljava/util/Map;
问题描述
我在 JSF 2.0文件上传中遵循了BalusC的回答中的步骤.我做出不同选择的唯一步骤是答案中的战斧"上载链接.链接已断开,所以我从另一个地方获取了tomahawk-1.1.11.当我尝试从Eclipse启动Tomcat 7.0.14时,出现以下错误:
I followed the steps in BalusC's answer at JSF 2.0 File upload. The only step in which I went differently is the Tomahawk upload link in the answer. The link is broken, so I got tomahawk-1.1.11 from another place. When I try to start Tomcat 7.0.14 from Eclipse I get the following error:
java.lang.NoSuchMethodError:
javax.servlet.ServletContext.getServletRegistrations()Ljava/util/Map;
并且Tomcat无法启动.有任何想法吗?另外,链接中的答案来自3月.在JSF 2中文件上传有什么发展?
And Tomcat doesn't start. Any ideas? Also, the answer in the link is from March. Any developments with file upload in JSF 2?
推荐答案
您的Web项目的/WEB-INF/lib
杂乱无章地包含了不同生成/版本的容器的servlet容器特定的库,例如servlet-api.jar
,
The /WEB-INF/lib
of your web project is cluttered with servletcontainer-specific libraries of a container of a different make/version, such as servlet-api.jar
, javaee.jar
, etc. Get rid of them.
The mentioned method is introduced in Servlet 3.0 and this error indicates that you've libraries of a Servlet 2.5 container or older in your /WEB-INF/lib
. If you have included them to circumvent Eclipse's compilation errors on javax.servlet.*
imports, then you should have solved it differently. Namely, by integrating the servletcontainer which you're actually going to use (which is Tomcat 7 in your case) as target runtime in Eclipse and associating the project with it.
请注意,此问题与JSF 2.0无关.您有一个异常,指向javax.servlet
程序包的方法,而不是javax.faces
程序包.
Please note that this problem is not related to JSF 2.0. You got an exception pointing to a method of the javax.servlet
package, not javax.faces
package.
这篇关于java.lang.NoSuchMethodError:javax.servlet.ServletContext.getServletRegistrations()Ljava/util/Map;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!