the method getVirtualServerName
has been added in ServletContext in Servlet 3.1. Find the java doc’s method getVirtualServerName
this problem can have at least 3 causes:
-
your servlet version is older that 3.1.
-
other jar has the servlet older version than 3.1.
-
your tomcat version is older than 8
to solve it, you can try the below way.
I. to check your pom.xml whether there are the below code.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.