本文共 1597 字,大约阅读时间需要 5 分钟。
the method getVirtualServerName
has been added in ServletContext in Servlet 3.1. Find the java doc’s method
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.
javax.servlet javax.servlet-api 3.1.0
if your pom.xml has the above code, it would still has that problem. you can do the second way.
II. to check your other jar has refer to the javax.servlet-api
jar. for example, the org.apache.santuario
has refer to the javax.servlet-api
jar. the pom.xml:
org.apache.santuario xmlsec 1.4.3
but when you look at the maven dependencies, it refer to the javax.servlet-api
jar whose version is 2.3 older than 3.1.
so you should exclude the 2.3 version. pom.xml:
org.apache.santuario xmlsec 1.4.3 javax.servlet servlet-api javax.servlet javax.servlet-api 3.1.0
III. spring boot run the default tomcat 7. so define your tomcat version 8 instead of tomcat 7. To add the code your pom.xml:
UTF-8 UTF-8 1.8 8.5.5
原文链接:
更多系列文章推荐:
转载地址:https://java-basketball.blog.csdn.net/article/details/78643626 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!