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

Related searches

This is my web.xml xsd

<?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_3_0.xsd"
    version="3.0">

Here is servlet node

<servlet>
    <servlet-name>spring1</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    <init-param> <!-- here is a problem -->
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring-servlet.xml</param-value>
    </init-param>
</servlet>

On the marked line xml validator says

cvc-complex-type.2.4.a: Invalid content was found starting with element 'init-param'. One of '{"http://java.sun.com/xml/ns/javaee":enabled, "http://java.sun.com/xml/ns/javaee":async-supported, "http://java.sun.com/xml/ns/javaee":run-as, "http://java.sun.com/xml/ns/javaee":security-role-ref, "http://java.sun.com/xml/ns/javaee":multipart-config}' is expected.

What is wrong and how do I correct this error?

The order of elements in web.xml matters and in all examples I've come across, the <load-on-startup> comes after <init-param>.

<servlet>
    <servlet-name>spring1</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring-servlet.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

Validation problem csvc-complex-type.2.4.a Invalid content, cvc-complex-type.2.4.a: Invalid content was found starting with element 'object_id '. One of '{object_id, description, level}' is expected. which I� cvc-complex-type.2.4.a: Invalid content was found starting with element 'location' 0 maven web.xml The element type “web-app” must be terminated by the matching end-tag “</web- app>”

It's pedantic, but <init-param> has to come before <load-on-startup>, so:

<servlet>
    <servlet-name>spring1</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param><!--here is a problem-->
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring-servlet.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

cvc-complex-type-2-4-a, Possible causes for this error: Elements are in incorrect order. Namespace definitions declared either in the root tag or a parent element don't match with the prefix (or no prefix) used in the element. cvc-complex-type.2.4.a: Invalid content was found starting with element 'modules'. I downloaded the force IDE and was able to successfully start a new project. My issue is with the files that were downloaded during the project creation. I received 10 errors on 10 individual package.xml files from the referenced package section.

Configure according to this

  <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">

      <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>

        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/dispatcher-servlet-context.xml</param-value>
        </context-param>

        <servlet>
            <servlet-name>dispatcher-servlet</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value></param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet-mapping>
            <servlet-name>dispatcher-servlet</servlet-name>
            <url-pattern>/*</url-pattern>
        </servlet-mapping>

    </web-app>

cvc-complex-type.2.4.a: Invalid content was found starting with , SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'objects. Hi,. I am trying to modify a flow that currently runs on 3.7.1, � cvc-complex-type.2.4.a: Invalid content was found starting with element 'CFTSScope'.

Getting "org.xml.sax.SAXParseException: cvc-complex-type.2.4.a , SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'xxxxx'". I have updated my pom.xml with plagins and got error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'plugin'. One of '{"http://maven.apache

Element name is mistyped. Mandatory element is missing; The end tag for an earlier element is missing; Element not described in schema is trying to be used. One reason for the above could be that not all of the expected elements are given. E.g. InitgPty/PstlAdr/Ctry is expected, instead InitgPty/Ctry is given; Elements are in incorrect order.

Business Rule X0000-005 - The XML data has failed schema validation. cvc-complex-type.2.4.a. Invalid content was found starting with element 'WagesNotShownAmt'.

Comments
  • You would think that there is a NICE way of saying that! instead of Invalid content was found starting with element 'init-param'. Maybe a case of RTFM...then id be busy reading till the cows come home...
  • This is madness. It also needs to come before <async-supported>
  • @CraigOtis just changed <async-supported> place to after <init-param> and saved. After that changed back to its old place and saved. Problem is gone now. Eclipse is the best IDE ever :) eclipse 2019-03