Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8295291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:32:12+00:00 2026-06-08T14:32:12+00:00

I am having a problem setting up the filter – the filter I have

  • 0

I am having a problem setting up the filter –
the filter I have defined in web.xml looks like this

  <filter>
   <filter-name>Log</filter-name>
   <filter-class>test.log</filter-class> 
 </filter>
 <filter-mapping>
   <filter-name>Log</filter-name>
   <url-pattern>/*</url-pattern>
 </filter-mapping>

But I am getting the following error –

SEVERE: Exception starting filter Log
java.lang.ClassNotFoundException: test.log
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:133)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:256)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

I have the class defined but for some reason I am getting the Classnotfoundexcetion. Can someone help me out?

EDIT —

I have a package called test and a class called log.

             package test;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;

    // Implements Filter class
     public class log implements Filter  {
         public void  init(FilterConfig config) {

          }
         public void  doFilter(ServletRequest request, 
             ServletResponse response,
             FilterChain chain) 
             throws java.io.IOException, ServletException {

  // Get the IP address of client machine.   
  String ipAddress = request.getRemoteAddr();

  // Log the IP address and current timestamp.
  System.out.println("IP "+ ipAddress + ", Time "
                                   + new Date().toString());

  // Pass request back down the filter chain
  chain.doFilter(request,response);
  }
   public void destroy( ){
      /* Called before the Filter instance is removed 
      from service by the web container*/
  }
 }

Thank You,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T14:32:14+00:00Added an answer on June 8, 2026 at 2:32 pm

    The filter-class parameter needs to be a Java class that should implement the Filter interface. Can you check if that’s the case with you?

    Check this example for guidance:

    http://viralpatel.net/blogs/tutorial-java-servlet-filter-example-using-eclipse-apache-tomcat/

    From the above link:

    <filter>
        <filter-name>LogFilter</filter-name>
        <filter-class>
            net.viralpatel.servlet.filters.LogFilter
        </filter-class>
        <init-param>
            <param-name>test-param</param-name>
            <param-value>This parameter is for testing.</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>LogFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    
    
    
    public class LogFilter implements Filter {
    
        public void doFilter(ServletRequest req, ServletResponse res,
                FilterChain chain) throws IOException, ServletException {...
        }
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having problem setting up tomcat context variable. I have tried: in web.xml
I am having a problem setting up a website under IIS 7. I have
I'm having a problem setting an image. I have a delegate telling me when
Hello i'm having slight problem when setting one cookie. I am using HttpWebRequest class
Am having a problem setting the gradient background of the selected listviewitem. Everytime I
I am having a problem setting up a simple test project for SignalR. I
I'm having a problem setting a cookie and doing a 302 redirect In chrome
I am having a problem setting up the following in Visual Studio 2008: a
I am having a problem setting the background of UITableView to a UIImageView (see
I am having a problem with setting cookie with php. I am trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.