springboot项目里javax.servlet-api冲突

2019-05-23  本文已影响0人  告诉自己活是干不完的

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>

上一篇 下一篇

猜你喜欢

热点阅读