I am getting an error in my GWT application being developed in Eclipse. It's in the web.xml
file. Here's the 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*)".
I have seen numerous posts about this and the problem is the order of the elements of the file, but that fix doesn't work for me (I have also tried putting all the <servlet-mapping>
tags right after the corresponding <servlet>
, it did not work either)
My web.xml
file :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>dispatch</servlet-name>
<servlet-class>com.yachtcloser.server.DispatchServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>upload</servlet-name>
<servlet-class>com.yachtcloser.server.UploadServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>download</servlet-name>
<servlet-class>com.yachtcloser.server.DownloadServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>com.yachtcloser.server.LoginServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatch</servlet-name>
<url-pattern>/dispatch.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>upload</servlet-name>
<url-pattern>/upload.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>download</servlet-name>
<url-pattern>/download.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/login.do</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>Yc.html</welcome-file>
</welcome-file-list>
</web-app>
Are there any other ways of tracking this error; other files that are linked to this?
well, as per new format of DTD web-app tag might contains following tags.
<!ELEMENT web-app (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*)>
above mentioned icon, display-name, description, distributable....etc are in the same order as they have mentioned in the DTD file.
e.g. if you put description tag before display-name it gives error.
I deleted the file and pasted the text from the old one into a new file with the same name and now there's no errors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With