cvc-complex-type.2.4.a: Invalid content was found starting with element

本文介绍了解决XML配置文件中出现的cvc-complex-type.2.4.a错误的方法。通过在Eclipse中正确配置XML catalog并引入特定的XSD文件,可以有效避免此类错误的发生。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在写xml的时候又一次总是报cvc-complex-type.2.4.a: Invalid content was found starting with element 错误,还出现小红叉,在网上找了很多,有说是把报红叉的代码写在<jsp-config></jsp-config>之间,试了之后发现完全没用。
   后来在外文网站上找到了一个方法就把问题解决了
   在eclipse中配置xmlcatalog
  1、 Location: D:\eclipse3.3\springmodules-cache.xsd    (springmodules-cache.xsd在本地的路径)
   Key Type: Namespace Name
   Key: http://www.springmodules.org/schema/cache/springmodules-  cache.xsd
   2、Location: D:\eclipse3.3\springmodules-ehcache.xsd(本地路径)
    Key Type: Schema Location
    Key: http://www.springmodules.org/schema/cache/springmodules-  ehcache.xsd
   然后再将这连个xsd加入到web.xml中就搞定了
后面可下载springmodules-  cache.xsd 和springmodules-ehcache.xsd  
    <?xml version="1.0" encoding="UTF-8"?>  
    <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"  
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance  http://www.springmodules.org/schema/cache/springmodules-cache.xsd http://www.springmodules.org/schema/cache/springmodules-ehcache.xsd"    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   
        http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd       
         ">  
        <!--OS Work Flow -->  
        <display-name>OSWorkflow Example App</display-name>  
        <description>OSWorkflow Example App</description>  
      
      
      
        <servlet>  
            <servlet-name>SOAPWorkflow</servlet-name>  
            <servlet-class>  
                com.opensymphony.workflow.soap.SOAPWorkflowServlet  
            </servlet-class>  
        </servlet>  
        <servlet>  
            <description>  
                This is the description of my J2EE component  
            </description>  
            <display-name>  
                This is the display name of my J2EE component  
            </display-name>  
            <servlet-name>Osworkflow</servlet-name>  
            <servlet-class>net.caiban.servlet.Osworkflow</servlet-class>  
        </servlet>  
        <servlet>  
            <description>  
                This is the description of my J2EE component  
            </description>  
            <display-name>  
                This is the display name of my J2EE component  
            </display-name>  
            <servlet-name>DoWorkflow</servlet-name>  
            <servlet-class>net.caiban.servlet.DoWorkflow</servlet-class>  
        </servlet>  
        <servlet>  
            <description>  
                This is the description of my J2EE component  
            </description>  
            <display-name>  
                This is the display name of my J2EE component  
            </display-name>  
            <servlet-name>CreateWorkflow</servlet-name>  
            <servlet-class>net.caiban.servlet.CreateWorkflow</servlet-class>  
        </servlet>  
      
      
      
      
        <servlet-mapping>  
            <servlet-name>SOAPWorkflow</servlet-name>  
            <url-pattern>/soap/*</url-pattern>  
        </servlet-mapping>  
      
        <servlet-mapping>  
            <servlet-name>Osworkflow</servlet-name>  
            <url-pattern>/servlet/Osworkflow</url-pattern>  
        </servlet-mapping>  
        <servlet-mapping>  
            <servlet-name>DoWorkflow</servlet-name>  
            <url-pattern>/servlet/DoWorkflow</url-pattern>  
        </servlet-mapping>  
        <servlet-mapping>  
            <servlet-name>CreateWorkflow</servlet-name>  
            <url-pattern>/servlet/CreateWorkflow</url-pattern>  
        </servlet-mapping>  
      
        <welcome-file-list>  
            <welcome-file>default.jsp</welcome-file>  
            <welcome-file>index.jsp</welcome-file>  
        </welcome-file-list>  
        <resource-ref>  
            <res-ref-name>jdbc/oswf</res-ref-name>  
            <res-type>javax.sql.DataSource</res-type>  
            <init-param driverClassName="com.mysql.jdbc.Driver" />  
            <init-param url="jdbc:mysql://localhost:3306/osworkflow" />  
            <init-param user="root" />  
            <init-param password="123465" />  
            <init-param max-connections="20" />  
            <init-param max-idle-time="30" />  
        </resource-ref>  
        <!--OS Work Flow -->  
    </web-app>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值