title: How to solve java.lang.NoSuchMethodException: package.MyCustomFilter.<init>() while starting the servlet filter
body: <p>The application server cannot start the servlet filter.
  The error message is <code>java.lang.NoSuchMethodException: package.MyCustomFilter.&lt;init&gt;()</code>.
  HttpFilter extends GenericFilter which implements the init() method. So there is no need to override it. I already tried to override the init() method it did not solve the problem.</p>
  <p>Filter class:</p>
  <pre class="lang-java prettyprint-override"><code>public class MyCustomFilter extends HttpFilter {
  
      private static final long serialVersionUID = -5281928035553598730L;
      private static Logger log = Logger.getLogger(MyCustomFilter.class.getName());
  
      protected MyCustomFilter() {
      }
  
      @Override
      public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
              throws IOException, ServletException {
          super.doFilter(req, res, chain);
          log.info(&quot;filter Request&quot;);
      }
  
  }
  </code></pre>
  <p>web.xml</p>
  <pre class="lang-xml prettyprint-override"><code>
  &lt;web-app xmlns=&quot;http://xmlns.jcp.org/xml/ns/javaee&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation=&quot;http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd&quot; version=&quot;4.0&quot;&gt;
         ...
       &lt;filter&gt;
          &lt;filter-name&gt;myCustomFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;com.dtmarius.gateway.filter.MyCustomFilter&lt;/filter-class&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;myCustomFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>