This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
The moose likes Tomcat and the fly likes parse error with web-app when starting tomact Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "parse error with web-app when starting tomact" Watch "parse error with web-app when starting tomact" New topic
Author

parse error with web-app when starting tomact

Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 588
I keep getting the follwoing error when starting tomact:

[ERROR] Digester - -Parse Error at line 25 column 11: The content of element type "web-app" must match "(icon?,displayname?,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*)". <org.xml.sax.SAXParseException:

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-envref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".>

The application was running ok, until I added another servlet : SetQueryGroupServlet

and then added the following code to map it in the web.xml

<?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>
<display-name>MonitorMaintenance</display-name>
<servlet>
<servlet-name>createANewqueryServlet</servlet-name>
<display-name>createANewqueryServlet</display-name>
<description>Creates a new Query</description>
<servlet-class>com.gfi.monitormaintenance.createANewqueryServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>createANewqueryServlet</servlet-name>
<url-pattern>/servlet/com.gfi.monitormaintenance.createANewqueryServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>SetQueryGroupServlet</servlet-name>
<display-name>SetQueryGroupServlet</display-name>
<description>Sets a group and id</description>
<servlet-class>com.gfi.monitormaintenance.SetQueryGroupServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SetQueryGroupServlet</servlet-name>
<url-pattern>/servlet/com.gfi.monitormaintenance.SetQueryGroupServlet</url-pattern>
</servlet-mapping>
</web-app>

I cant see what the problem is and why would this error be thrown.

Thanks for any help Tony
Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 588
Sorted the problem out, all servlets needed to be added before servlet mapping :

<?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>
<display-name>MonitorMaintenance</display-name>
<servlet>
<servlet-name>createANewqueryServlet</servlet-name>
<display-name>createANewqueryServlet</display-name>
<description>Creates a new Query</description>
<servlet-class>com.gfi.monitormaintenance.createANewqueryServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>SetQueryGroupServlet</servlet-name>
<display-name>SetQueryGroupServlet</display-name>
<description>Sets a group and id</description>
<servlet-class>com.gfi.monitormaintenance.SetQueryGroupServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>createANewqueryServlet</servlet-name>
<url-pattern>/servlet/com.gfi.monitormaintenance.createANewqueryServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SetQueryGroupServlet</servlet-name>
<url-pattern>/servlet/com.gfi.monitormaintenance.SetQueryGroupServlet</url-pattern>
</servlet-mapping>
</web-app>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: parse error with web-app when starting tomact