title: class not found exception for Servlet filter
body: <p>I'm trying to create a basic servlet filter, I have created the filter and mapped it in the web.xml file but get filter not found exceptions.</p>
  
  <p>Here's the web.xml file</p>
  
  <pre><code> &lt;display-name&gt;Disertation&lt;/display-name&gt;
    &lt;filter&gt;
         &lt;filter-name&gt;AuthorizationFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;Disertation.servlets.AuthorizationFilter&lt;/filter-class&gt;       
      &lt;/filter&gt;   
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;AuthorizationFilter&lt;/filter-name&gt;
          &lt;servlet-name&gt;LoginServlet&lt;/servlet-name&gt;
      &lt;/filter-mapping&gt;
  
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Here is the path for the filter class: Disertation/src/servlets/AuthorizationFilter.java</p>
  
  <p>Am i missing something or is my configuration wrong?</p>
  
  <p>EDIT: I took the com out of the web.xml and Here is the filter class</p>
  
  <pre><code>    package servlets;
  
  import java.io.IOException;
  
  import javax.servlet.Filter;
  import javax.servlet.FilterChain;
  import javax.servlet.FilterConfig;
  import javax.servlet.ServletContext;
  import javax.servlet.ServletException;
  import javax.servlet.ServletRequest;
  import javax.servlet.ServletResponse;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import JavaBeans.User;
  
  
  /**
   * Servlet Filter implementation class AuthorizationFilter.
   * Its purpose is to check logged-in user's role and
   * and accordingly allow or prevent access to the web resources.
   */
  public class AuthorizationFilter implements Filter {
      private FilterConfig filterConfig;
  
      /**
       * @see Filter#init(FilterConfig)
       */
      @Override
      public void init(FilterConfig filterConfig) throws ServletException {
          this.filterConfig=filterConfig;
      }
  
      /**
       * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
       */
      @Override
      public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
                  throws IOException, ServletException {
          HttpServletRequest request = (HttpServletRequest) req;
          ServletContext sc= filterConfig.getServletContext();
       String username = request.getParameter("user");
       String pwd = request.getParameter("pwd");
       System.out.println("first check");
  
       User user = new User (username, pwd, "employee");
       System.out.println("is this getting here?");
       request.setAttribute("role", user.getRole());
          if (request.getAttribute("role").equals("employee")|| request.getAttribute("role").equals("admin")) 
  
              chain.doFilter(request, res);
  
      }
  
  
      /**
       * @see Filter#destroy()
       */
      @Override
      public void destroy() {
          filterConfig=null;
      }
  
  }
  </code></pre>