title: @MultipartConfig override in web.xml
body: <p>So I have this servlet :</p>
  
  <pre><code>    @WebServlet(name = "StudentRegistrationUsn", urlPatterns = {"/university/student/registration"})
  @MultipartConfig(maxFileSize = 10*1024*1024,maxRequestSize = 20*1024*1024,fileSizeThreshold = 5*1024*1024)
  public class ActionRegistrationServlet extends HttpServlet {
  
      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          //handle file upload
      }
  </code></pre>
  
  <p>Everything works fine, files are uploading.
  Then I try to override the fileSize and Threshold in web.xml:</p>
  
  <pre><code>    &lt;servlet&gt;
          &lt;servlet-name&gt;StudentRegistrationUsn&lt;/servlet-name&gt;
          &lt;multipart-config&gt;
              &lt;max-file-size&gt;10485760&lt;/max-file-size&gt;
              &lt;max-request-size&gt;20971520&lt;/max-request-size&gt;
              &lt;file-size-threshold&gt;5242880&lt;/file-size-threshold&gt;
          &lt;/multipart-config&gt;
      &lt;/servlet&gt;
  </code></pre>
  
  <p>When I do that, tomcat crashes and whenever I try to access that servlet it gives the following exception:</p>
  
  <pre><code>The server encountered an internal error that prevented it from fulfilling this request.
  
  exception
  
  java.lang.NullPointerException
      sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      java.lang.ClassLoader.loadClass(ClassLoader.java:356)
      org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1629)
      org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:461)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
      org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1813)
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      java.lang.Thread.run(Thread.java:722)
  </code></pre>