java.lang.NoSuchMethodError:javax.servlet.ServletContext.getServletRegistrations()Ljava/util/Map; [英] java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletRegistrations()Ljava/util/Map;

查看:476
本文介绍了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.

提到的方法,并且此错误表明您在/WEB-INF/lib中具有Servlet 2.5容器或更旧的库.如果您包括了它们以规避javax.servlet.*导入中的Eclipse编译错误,那么您应该以不同的方式解决它.即,通过在Eclipse中集成您将实际使用的servlet容器(在您的情况下为Tomcat 7)作为目标运行时,并将项目与之关联.

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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆