Error: javax.servlet.ServletContext.getVirtualServerName() Ljava/lang/String

Asked on January 02, 2015
Hi All, In my spring application, I am getting below exception. Need help.

Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;
at org.apache.tomcat.websocket.server.WsServerContainer.<init>(
at org.apache.tomcat.websocket.server.WsSci.init(
at org.apache.tomcat.websocket.server.WsSci.onStartup(
at org.apache.catalina.core.StandardContext.startInternal(
at org.apach

Replied on January 03, 2015

getVirtualServerName has been added in ServletContext in Servlet 3.1.  Find the java doc.

The error is that in your server, servlet version is older that 3.1.

You can update servlet-api  jar for latest one in server lib.
If tomcat, the location will be TOMCAT_HOME/lib

Write Answer

©2023 | Privacy Policy | Contact Us