facebook

More than one servlet entry in web.xml causes errors

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #232785 Reply

    Riyad Kalla
    Member

    Copied from PM

    Hi,
    Im using Eclipse IDE and have MyEclipse plugin. I have created a J2EE project and when I have more than one entry for servlet in web.xml im getting this following error.
    The content of element type “web-app” must match (icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)
    If I remove all the servlet entry but one this error is not shown. Any suggesstions why this is happening.

    Regards,
    Sun.

    #232786

    Riyad Kalla
    Member

    The reason this is happening is because the web.xml file requires a certain order to it. What you are likely doing is adding your <servlet> entries out of sequence with the other tags. Take a look at that long error message:

    (icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)

    That is the order the tags must occur in.

    #232806

    The problem is beacuse we were migrating our application to tomcat4 from tomcat3. With tomcat4 it is checking for the ordering of elements. We had the same web.xml deployed in tomcat3 for years and it was not having issues. Starting from tomcat4 they have made a check for the ordering of the elements in web.xml.

    Regards,
    Sundar.

    #232835

    Scott Anderson
    Participant

    Sundar,

    Starting from tomcat4 they have made a check for the ordering of the elements in web.xml.

    Yes, the ordering is enforced by default in Tomcat 4. Luckily, reordering your descriptor shouldn’t be a big deal.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: More than one servlet entry in web.xml causes errors

You must be logged in to post in the forum log in