"web.xml" validation error while upgrading from EAP 4.X to EAP 5.x

Solution Verified - Updated -

Issue

  • In the process of migrating our application from JBoss 4.X to JBoss 5, we ran into below error when trying to deploy our applications which contains the following kind of "web.xml":
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" 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 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <servlet>
        <servlet-name>SomeInitializer</servlet-name>
        <display-name>Some Initializer Servlet</display-name>
        <servlet-class>com.some.SomeInitializerServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
</web-app>
  • In this case the below kind of error can be found while deploying the application:
Deployment "vfszip://home/userone/jboss-eap-5.1/jboss-as//server/default/deploy/fmis.ear/" is in error due to the following reason(s):  
 org.xml.sax.SAXException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'display-name'.  
 One of '{"http://java.sun.com/xml/ns/j2ee":servlet-class, "http://java.sun.com/xml/ns/j2ee":jsp-file}' is expected.  
 @ vfszip://home/userone/jboss-eap-5.1/jboss-as//server/default/deploy/TestApp.ear/TestApp.war/WEB-INF/web.xml[8,10]  

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 5.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content