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

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>

Leave a Comment