java weblogic.xml 中的错误:cvc-complex-type.2.4.a:发现以元素“prefer-application-packages”开头的无效内容

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14556050/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 16:39:33  来源:igfitidea点击:

Error in weblogic.xml : cvc-complex-type.2.4.a: Invalid content was found starting with element 'prefer-application-packages'

javaxmlspringspring-mvcxml-parsing

提问by stallion

I am using springs source tool suite. I am getting an error in weblogic.xml file--

我正在使用 springs 源工具套件。我在 weblogic.xml 文件中收到一个错误——

cvc-complex-type.2.4.a: Invalid content was found starting with element 'prefer-   
application-packages'. One of '{"http://www.bea.com/ns/weblogic/weblogic-web-app":retain-
original-url, "http://www.bea.com/ns/weblogic/weblogic-web-app":show-archived-real-path-
enabled, "http://www.bea.com/ns/weblogic/weblogic-web-app":require-admin-traffic,    
"http://www.bea.com/ns/weblogic/weblogic-web-app":access-logging-disabled}' is expected.
enter code here

and my weblogic.xml looks like this

我的 weblogic.xml 看起来像这样

<?xml version="1.0"?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app"     
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app   
http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
<jsp-descriptor>
    <keepgenerated>true</keepgenerated>
    <page-check-seconds>60</page-check-seconds>
    <precompile>true</precompile>
    <precompile-continue>true</precompile-continue>
</jsp-descriptor>
<container-descriptor>
    <optimistic-serialization>true</optimistic-serialization>
    <prefer-application-packages>
        <package-name>antlr.*</package-name>
        <package-name>javax.persistence.*</package-name>
        <package-name>org.apache.commons.*</package-name>  
    </prefer-application-packages>
    <show-archived-real-path-enabled>true</show-archived-real-path-enabled>
</container-descriptor>

</weblogic-web-app>

the error is shown at the beginning of tag..

错误显示在标签的开头..

采纳答案by stallion

weblogic-web-app
xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd
http://xmlns.oracle.com/weblogic/weblogic-web-app
http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">

changed the namespace to the above one.. it worked now..

将命名空间更改为上述命名空间.. 现在可以工作了..

回答by Michael Kay

I don't know anything about weblogic, but the schema you reference at

我对 weblogic 一无所知,但您参考的架构

http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd

http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd

shows what child elements are expected inside a container-descriptor element, and they don't permit a prefer-application-packages element.

显示容器描述符元素中预期的子元素,并且它们不允许首选应用程序包元素。

回答by Mohit Singh

Order should be same as given below

顺序应与下面给出的相同

<wls:timeout-secs>1800</wls:timeout-secs>
<wls:cookie-path>/my</wls:cookie-path>
<wls:cookie-secure>true</wls:cookie-secure>
<wls:cookie-http-only>true</wls:cookie-http-only>
<wls:url-rewriting-enabled>false</wls:url-rewriting-enabled>