gpt4 book ai didi

java - 在 Weblogic 中部署 war 文件时出现验证错误

转载 作者:行者123 更新时间:2023-11-30 10:38:10 26 4
gpt4 key购买 nike

在weblogic中部署war文件时出现如下错误

Message icon - Error VALIDATION PROBLEMS WERE FOUND <5:4> problem: cvc->complex-type.2.3: Element 'web-app@http://java.sun.com/xml/ns/javaee' with element-only content type cannot have text content. <14:5> problem: cvc-complex-type.2.4a: Expected element 'url-pattern@http://java.sun.com/xml/ns/javaee' instead of 'load-on-startup@http://java.sun.com/xml/ns/javaee' here in element servlet-mapping@http://java.sun.com/xml/ns/javaee <18:5> problem: cvc-complex-type.2.4b: Element not allowed: listener-class@http://java.sun.com/xml/ns/javaee in element listener@http://java.sun.com/xml/ns/javaee

下面是我的web.xml

<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee ">
>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
<load-on-startup>1</load-on-startup>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
<listener-class>
org.springframework.security.web.session.HttpSessionEventPublisher
</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/mvc-dispatcher-servlet.xml
</param-value>
</context-param>

这是我的 weblogic.xml

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app"
xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app ht
tp://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
<context-root>/</context-root>
<container-descriptor>
<show-archived-real-path-enabled>true</show-archived-real-path-enabled>
<prefer-application-packages>
<package-name>javax.faces.*</package-name>
<package-name>com.sun.faces.*</package-name>
<package-name>com.bea.faces.*</package-name>
<package-name>org.slf4j.*</package-name>
<package-name>com.google.common.*</package-name>
</prefer-application-packages>

<prefer-application-resources>
<resource-name>javax.faces.*</resource-name>
<resource-name>com.sun.faces.*</resource-name>
<resource-name>com.bea.faces.*</resource-name>
<resource-name>com.google.common.*</resource-name>
<resource-name>org/slf4j/impl/StaticLoggerBinder.class</resource-name>
<resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
</prefer-application-resources>
</container-descriptor>
<session-descriptor>
<cookie-secure>true</cookie-secure>
<url-rewriting-enabled>false</url-rewriting-enabled>
<!-- <cookie-http-only>true</cookie-http-only> -->
</session-descriptor>
<virtual-directory-mapping>
<local-path>/usr/local/WebLogic/wlApps/miDocs</local-path>
<url-pattern>/docs/*</url-pattern>
</virtual-directory-mapping>

文件夹结构与 oracle website 中的描述匹配

感谢任何帮助

最佳答案

想想你这里有两个问题:

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee ">
>

首先是 schemaLocation 末尾的空白。第二个 > 太多了

关于java - 在 Weblogic 中部署 war 文件时出现验证错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39844919/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com