美文网首页
springboot项目里javax.servlet-api冲突

springboot项目里javax.servlet-api冲突

作者: 告诉自己活是干不完的 | 来源:发表于2019-05-23 20:53 被阅读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>

相关文章

网友评论

      本文标题:springboot项目里javax.servlet-api冲突

      本文链接:https://www.haomeiwen.com/subject/ukhizqtx.html