在Weblogic中部署war文件时验证错误

时间:2016-10-04 05:43:21

标签: java spring-mvc weblogic war

在weblogic

中部署war文件时出现以下错误
  

消息图标 - 发现错误验证问题< 5:4>问题:cvc-> complex-type.2.3:元素' web-app @ http://java.sun.com/xml/ns/javaee'仅限元素的内容类型不能包含文本内容。 < 14:5个问题:cvc-complex-type.2.4a:预期元素' url-pattern @ http://java.sun.com/xml/ns/javaee'而不是“{@ 3}}'这里是元素servlet-mapping @ http://java.sun.com/xml/ns/javaee< 18:5>问题:cvc-complex-type.2.4b:元素不允许:元素监听器中的监听器类@ http://java.sun.com/xml/ns/javaee @ 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>

文件夹结构根据http://java.sun.com/xml/ns/javaee

中的说明进行匹配

感谢任何帮助

2 个答案:

答案 0 :(得分:1)

认为你有两个问题:

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

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

答案 1 :(得分:0)

<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>
        <load-on-startup>1</load-on-startup>        
    </servlet>
    <servlet-mapping>
        <servlet-name>mvc-dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
    <listener>
        <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>
</web-app>