WebLogic中的web.xml和weblogic.xml的验证错误

时间:2017-01-31 12:30:48

标签: java weblogic xml-validation

我正在尝试在WebLogic 12c服务器上部署Web应用程序,但我在XML中遇到验证错误。我尝试更改架构和命名空间的版本,但它不起作用,我无法弄清楚到底出了什么问题。

我的web.xml文件:

<?xml version="1.0"?>
<web-app version="2.5" 
xmlns="http://java.sun.com/xml/ns/javaee" 
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/web-app_2_5.xsd">             
    <context-param>
        <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.LIBRARIES</param-name>
        <param-value>/WEB-INF/tomahawk.taglib.xml;/WEB-INF/sgdem.taglib.xml</param-value>
    </context-param>
</web-app>

我的weblogic.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app version="1.0"
xmlns="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/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
http://xmlns.oracle.com/weblogic/weblogic-web-app
http://xmlns.oracle.com/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
    <fast-swap>
        <enabled>true</enabled>
    </fast-swap>   
</weblogic-web-app>

错误:

weblogic.application.ModuleException: VALIDATION PROBLEMS WERE FOUND
  <11: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.
    at weblogic.servlet.internal.WebAppModule.createModuleException(WebAppModule.java:1824)
    at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:1482)
    at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:245)
    at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:682)
    at weblogic.application.internal.flow.ScopedModuleDriver.init(ScopedModuleDriver.java:162)
    Truncated. see log file for complete stacktrace
Caused By: weblogic.descriptor.DescriptorException: VALIDATION PROBLEMS WERE FOUND
  <11: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.
    at weblogic.descriptor.internal.MarshallerFactory$1.evaluateResults(MarshallerFactory.java:245)
    at weblogic.descriptor.internal.MarshallerFactory$1.evaluateResults(MarshallerFactory.java:231)
    at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:155)
    at weblogic.descriptor.BasicDescriptorManager.createDescriptor(BasicDescriptorManager.java:327)
    at weblogic.application.descriptor.AbstractDescriptorLoader2.getDescriptorBeanFromReader(AbstractDescriptorLoader2.java:817)
    Truncated. see log file for complete stacktrace

1 个答案:

答案 0 :(得分:0)

由于应用程序的web.xml包含文件中的特殊字符而发生此错误。在重新部署应用程序之前,请确保web.xml和weblogic.xml在文件中不包含任何特殊字符,不受支持的标记或符号。

的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         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/web-app_2_5.xsd"
         version="2.5">
    <context-param>
        <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.LIBRARIES</param-name>
        <param-value>/WEB-INF/tomahawk.taglib.xml;/WEB-INF/sgdem.taglib.xml</param-value>
    </context-param>
</web-app>

weblogic.xml中

<?xml version="1.0" encoding="UTF-8"?>        
<weblogic-web-app xmlns="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/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">   
    <fast-swap>
        <enabled>false</enabled>        
    </fast-swap>
</weblogic-web-app>