Discussion:
Parse error in application web.xml
Lott, Carey
2003-01-17 18:33:16 UTC
Permalink
Instead of depending on the invoker servlet, I have added our servlets to
the web.xml file inside of the app's WEB-INF directory. However, now I am
getting the following error when I try to start tomcat with the changed
web.xml:

2003-01-17 13:07:51 ContextConfig[/esd] Parse error in application web.xml
org.xml.sax.SAXParseException: The content of element type "web-app" must
match
"(icon?,display-name?,description?,distributable?,context-param*,filter*,fil
ter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mappin
g*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,se
curity-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-loca
l-ref*)".

I have validated the web.xml file using IE. No errors are apparent. The
file displays properly in the browser. Can somebody look at the web.xml,
and see what I am missing? I know it has to be something really easy that I
am overlooking.

Thanks in advance for the Help

web.xml file:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!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>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<!-- Example
<servlet>
<servlet-name>DateServlet</servlet-name>
<servlet-class>DateServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DateServlet</servlet-name>
<url-pattern>/servlet/DateServlet</url-pattern>
</servlet-mapping>
-->

<servlet>
<servlet-name>DDSMenu</servlet-name>
<servlet-class>DDSMenu</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DDSMenu</servlet-name>
<url-pattern>/DDSMenu</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>DDSHome</servlet-name>
<servlet-class>DDSHome</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DDSHome</servlet-name>
<url-pattern>/DDSHome</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>DDSLogin</servlet-name>
<servlet-class>DDSLogin</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DDSLogin</servlet-name>
<url-pattern>/DDSLogin</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>DDSLog</servlet-name>
<servlet-class>DDSLog</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DDSLog</servlet-name>
<url-pattern>/DDSLog</url-pattern>
</servlet-mapping>


</web-app>
Lajos Moczar
2003-01-17 18:35:29 UTC
Permalink
Carey -

Put all <servlet> tags together and then all <servlet-mapping> tags
together AFTER the <servlet> tags.

Regards,


Lajos
Post by Lott, Carey
Instead of depending on the invoker servlet, I have added our servlets to
the web.xml file inside of the app's WEB-INF directory. However, now I am
getting the following error when I try to start tomcat with the changed
2003-01-17 13:07:51 ContextConfig[/esd] Parse error in application web.xml
org.xml.sax.SAXParseException: The content of element type "web-app" must
match
"(icon?,display-name?,description?,distributable?,context-param*,filter*,fil
ter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mappin
g*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,se
curity-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-loca
l-ref*)".
I have validated the web.xml file using IE. No errors are apparent. The
file displays properly in the browser. Can somebody look at the web.xml,
and see what I am missing? I know it has to be something really easy that I
am overlooking.
Thanks in advance for the Help
<?xml version="1.0" encoding="ISO-8859-1"?>
<!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>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- Example
<servlet>
<servlet-name>DateServlet</servlet-name>
<servlet-class>DateServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DateServlet</servlet-name>
<url-pattern>/servlet/DateServlet</url-pattern>
</servlet-mapping>
-->
<servlet>
<servlet-name>DDSMenu</servlet-name>
<servlet-class>DDSMenu</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DDSMenu</servlet-name>
<url-pattern>/DDSMenu</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>DDSHome</servlet-name>
<servlet-class>DDSHome</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DDSHome</servlet-name>
<url-pattern>/DDSHome</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>DDSLogin</servlet-name>
<servlet-class>DDSLogin</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DDSLogin</servlet-name>
<url-pattern>/DDSLogin</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>DDSLog</servlet-name>
<servlet-class>DDSLog</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DDSLog</servlet-name>
<url-pattern>/DDSLog</url-pattern>
</servlet-mapping>
</web-app>
--
--
Lajos Moczar
----------------------------------------
Open Source Support, Consulting and Training
----------------------------------------
Cocoon Developer's Handbook
(www.amazon.com/exec/obidos/tg/detail/-/0672322579)

_ _____
/ \ /
/___\ /
/ \ /____

http://www.galatea.com -- powered by AzSSL
Shapira, Yoav
2003-01-17 18:36:53 UTC
Permalink
Hi,
Post by Lott, Carey
Instead of depending on the invoker servlet, I have added our servlets
to

Good.
Post by Lott, Carey
2003-01-17 13:07:51 ContextConfig[/esd] Parse error in application
web.xml
Post by Lott, Carey
org.xml.sax.SAXParseException: The content of element type "web-app"
must
Post by Lott, Carey
match
"(icon?,display-name?,description?,distributable?,context-
param*,filter*,fil
ter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-
mappin
g*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-
ref*,se
curity-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb
-
Post by Lott, Carey
loca
l-ref*)".
I have validated the web.xml file using IE. No errors are apparent.
The

You may have viewed the file using IE, not validated it ;) ;)

IE would not check against the scheme. The error reported suggests you
have elements in the wrong order. It tells you what the right order is.
For example, <welcome-file-list> cannot come before <servlet>.

Reorganize your web.xml file according to the spec, i.e. in the order
shown above, and the error will go away.

Yoav Shapira
Millennium ChemInformatics
Lott, Carey
2003-01-17 18:57:49 UTC
Permalink
That was it. Thanks
I placed welcome-file-list element at the bottom and then grouped all of the
servlet elements together and underneath it all of the servlet-mapping
elements. It finally started up with out an error.

Thanks Again. If anybody is interested below is my corrected version.

web.xml file:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!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>DDSMenu</servlet-name>
<servlet-class>DDSMenu</servlet-class>
</servlet>
<servlet>
<servlet-name>DDSHome</servlet-name>
<servlet-class>DDSHome</servlet-class>
</servlet>
<servlet>
<servlet-name>DDSLogin</servlet-name>
<servlet-class>DDSLogin</servlet-class>
</servlet>
<servlet>
<servlet-name>DDSLog</servlet-name>
<servlet-class>DDSLog</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>DDSMenu</servlet-name>
<url-pattern>/DDSMenu</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>DDSHome</servlet-name>
<url-pattern>/DDSHome</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>DDSLogin</servlet-name>
<url-pattern>/DDSLogin</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>DDSLog</servlet-name>
<url-pattern>/DDSLog</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

</web-app>

-----Original Message-----
From: Shapira, Yoav [mailto:***@mpi.com]
Sent: Friday, January 17, 2003 1:37 PM
To: Tomcat Users List
Subject: RE: Parse error in application web.xml


Hi,
Post by Lott, Carey
Instead of depending on the invoker servlet, I have added our servlets
to

Good.
Post by Lott, Carey
2003-01-17 13:07:51 ContextConfig[/esd] Parse error in application
web.xml
Post by Lott, Carey
org.xml.sax.SAXParseException: The content of element type "web-app"
must
Post by Lott, Carey
match
"(icon?,display-name?,description?,distributable?,context-
param*,filter*,fil
ter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-
mappin
g*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-
ref*,se
curity-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb
-
Post by Lott, Carey
loca
l-ref*)".
I have validated the web.xml file using IE. No errors are apparent.
The

You may have viewed the file using IE, not validated it ;) ;)

IE would not check against the scheme. The error reported suggests you
have elements in the wrong order. It tells you what the right order is.
For example, <welcome-file-list> cannot come before <servlet>.

Reorganize your web.xml file according to the spec, i.e. in the order
shown above, and the error will go away.

Yoav Shapira
Millennium ChemInformatics

--
To unsubscribe, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>

Loading...