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>

您的资助是我最大的动力!
金额随意,欢迎来赏!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)