问题描述
为了支持 JUnit 5,我最近将 Spring Boot 应用程序升级到版本 2.4.7
。
本地开发使用嵌入式 Tomcat 服务器,而所有其他环境在 Weblogic 服务器 12.1.3
上运行。
一切都在本地运行,但使用 Weblogic Server 会导致以下异常:
Caused By: weblogic.descriptor.DescriptorException: VALIDATION PROBLEMS WERE FOUND
/weblogic.utils.classloaders.GenericclassLoader@700d06bb finder: weblogic.utils.classloaders.CodeGenClassFinder@40ce7cdd annotation: APP@/WEB-INF/lib/tomcat-embed-websocket-9.0.46.jar!/meta-inf/web-fragment.xml:18:3:18:3: problem: cvc-enumeration-valid: string value '4.0' is not a valid enumeration value for web-app-versionType in namespace http://xmlns.jcp.org/xml/ns/javaee
at weblogic.descriptor.internal.MarshallerFactory$1.evaluateResults(MarshallerFactory.java:249)
关于该主题的其他问题让我检查了 web.xml
,但它包含 version="3.0"
。
我不知道如何继续,因为我不明白这是从哪里来的。
解决方法
你的 pom.xml 中是否有这个以在创建 war 文件时排除 tomcat jar 文件的打包?
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
spring-boot-starter-tomcat 依赖项必须具有提供的范围。