File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes == Filter Problem == Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "== Filter Problem ==" Watch "== Filter Problem ==" New topic

== Filter Problem ==

Dave Van Even
Ranch Hand

Joined: Jul 19, 2001
Posts: 101
I installed JDK1.4 & Tomcat 4.0.2 just to rule out some potential sources of my problem.
When I put this code in my web.xml file

I get this error

Create Catalina server
Starting service Tomcat-Standalone
Apache Tomcat/4.0.2
PARSE error at line 88 column 11
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-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".

here is my DTD
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

I'm using the right servlet.jar version but I can't seem to find what is causing this problem. When I remove the <filter> & <filter-mapping> tags from my web.xml I don't get errors..

Can anybody tell me what I'm doing wrong ? It would be very much appreciated
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Order, Order, Order.

It's a mantra when doing XML.

Not only does a tag need to be contained within the right tag, it needs to be in order.

So... where is your <filter> and <filter-mapping> tags, in relation to all the other tags that belong inside <web-app> ?

They must be after any <context-param> elements, but before any <listener> elements.
Dave Van Even
Ranch Hand

Joined: Jul 19, 2001
Posts: 101
cheers mike !!
I've put the <servlet> & <servlet-mapping> tag in the right place now... works smootly
I agree. Here's the link:
subject: == Filter Problem ==
It's not a secret anymore!