返回顶部

javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String; springCloud项目启动报错

2023-02-21 11:44:13.924 ERROR 27256 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

org.apache.catalina.authenticator.AuthenticatorBase.startInternal(AuthenticatorBase.java:1318)

The following method did not exist:

javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;

The calling method's class, org.apache.catalina.authenticator.AuthenticatorBase, was loaded from the following location:

jar:file:/E:/SoftWareInstall/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.56/tomcat-embed-core-9.0.56.jar!/org/apache/catalina/authenticator/AuthenticatorBase.class

 

 

 

 

开发springboot项目启动时出现了下面的错误一直没有找到原因:后来发现是 servetl包冲突,有servert-api2.4, 有javax.servlet-api.3.1而且有多份,我一个一个的去除依赖关系,最后剩下一份javax.servlet-api.3.1时正常。

 

 

下面是排除配置:

 <dependency>
            <groupId>com.atguigu.gulimall</groupId>
            <artifactId>gulimall-common</artifactId>
            <version>0.0.1-SNAPSHOT</version>
            <exclusions>
                <exclusion>
                    <groupId>com.baomidou</groupId>
                    <artifactId>mybatis-plus-boot-starter</artifactId>
                </exclusion>
                <!--这里把公共模块中引入的servlet-api排除掉,因为下面的web中是有其中的一些依赖的,导致依赖重复冲突,所以将整个exclusion排除掉-->

                    <exclusion>
                        <artifactId>servlet-api</artifactId>
                        <groupId>javax.servlet</groupId>
                    </exclusion>

            </exclusions>
        </dependency>
posted @ 2023-02-21 11:49  fen斗  阅读(373)  评论(0)    收藏  举报