1.解决javax.servlet-api.jar冲突的问题,在springboot项目里,tomcat的依赖会涉及javax.servlet-api??。而自己引入的jar包工程里可能也会有涉及javax.servlet-api。这样就产生了冲突。to check your other jar has refer to the javax.servlet-apijar. for example, theorg.apache.santuariohas refer to thejavax.servlet-apijar. the pom.xml:
参考连接:https://stackoverflow.com/questions/34950164/getting-nosuchmethoderrorjavax-servlet-servletcontext-getvirtualservername
<!-- exclude servlet-api 2.3 jar-->
<dependency>
<groupId>org.apache.santuario</groupId>
<artifactId>xmlsec</artifactId>
<version>1.4.3</version>
<exclusions> //去掉原来工程里的javax.servlet
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- servlet-api 3.1 version has getVirtualServerName() -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>