perhaps
you should be clear in explaining what it is you're trying to achieve and what kind of error you're getting ;-)
The purpose of a
Servlet Filter is to intercept a Servlet request and possibly apply certain pre-processing logic modifying or blocking the response if you choose. One use can be auditing of requests (hit counters etc.), another use is in security to check if access to a resource can be granted for example checking to see if the user is logged in etc.