为了支持 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 依赖项必须具有 provided 范围。
无法在 weblogic 14c 上部署。我修改了web.xml,参考oracle weblogic 14c官方文档,解决了我的问题。
发现验证问题<2:3>问题:cvc-enumeration-valid:字符串值“4.0”不是命名空间中 web-app-versionType 的有效枚举值http://java.sun.com/xml/ns/javaee
web.xml 命名空间声明和架构位置 web.xml 文件的命名空间声明和架构位置的正确文本如下。
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
id="WebApp_ID" version="4.0">