Getting NoSuchMethodError:javax.servlet.ServletContext.getVirtualServerName()
在 Tomcat 8 中部署服务期间,我遇到了一个问题。得到以下错误:
Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;at org.apache.tomcat.websocket.server.WsServerContainer.(WsServerContainer.java:149) at org.apache.tomcat.websocket.server.WsSci.init(WsSci.java:131) at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:47) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5244) at org.apache.catalina.util.Base Lifecycle.start(LifecycleBase.java:150) ...10更多
方法在Servlet 3.1中引入,从我的jar中提取后,我得到了以下细节:getVirtualServerName
MANIFEST.MF
servlet-api
Specification-Title: Java API for Servlets
Specification-Version: 3.1
Specification-Vendor: Sun Microsystems, Inc.
Implementation-Title: javax.servlet
这说明它有3.1。那么这个错误还有其他原因吗?请帮忙