title: AWS ec2 instance running tomcat 8 gives error: getDispatcherType() is undefined for the type HttpServletRequest
body: <p><strong>getDispatcherType() is undefined for the type HttpServletRequest when deploying to aws ec2 instance running tomcat 8 using beanstalk. Same webapp works when deployed on localhost on my machine.</strong></p>
  
  <p>The project runs perfectly when deployed on localhost in my machine but gives error when deployed on AWS using beanstalk. I am using eclipse with aws java toolkit.</p>
  
  <ol>
  <li>I have used javax.servlet-api version 3.0.1 with scope provided.</li>
  <li>I have removed all maven dependencies on servlet-api 2.5.</li>
  <li>The webapp runs perfectly on localhost in my machine.</li>
  <li>I downloaded the zip of uploaded package from aws and it only contains javax.servlet-api 3.0.1 and no other version of it.</li>
  </ol>
  
  <p>Here is the stacktrace.</p>
  
  <pre><code>org.apache.jasper.JasperException: Unable to compile class for JSP: 
  An error occurred at line: [82] in the generated java file: [/usr/share/tomcat8/work/Catalina/localhost/ROOT/org/apache/jsp/WEB_002dINF/jsp/login_jsp.java]
  The method getDispatcherType() is undefined for the type HttpServletRequest
  
  Stacktrace:
  org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
  org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:198)
  org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:450)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:361)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:336)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
  org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:570)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:356)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
  org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209)
  org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:266)
  org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1225)
  org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1012)
  org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
  org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)
  org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
  org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
  org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
  org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
  org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
  org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:168)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:96)
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
  org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
  org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
  </code></pre>
  
  <p>This is my pom.xml file with all dependecies:</p>
  
  <pre><code>&lt;properties&gt;
      &lt;spring.version&gt;4.0.1.RELEASE&lt;/spring.version&gt;
      &lt;spring.security.version&gt;4.0.1.RELEASE&lt;/spring.security.version&gt;     
  &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.microsoft.azure&lt;/groupId&gt;
              &lt;artifactId&gt;azure-documentdb&lt;/artifactId&gt;
              &lt;version&gt;1.0.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
              &lt;artifactId&gt;gson&lt;/artifactId&gt;
              &lt;version&gt;2.3.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.mail&lt;/groupId&gt;
              &lt;artifactId&gt;mail&lt;/artifactId&gt;
              &lt;version&gt;1.4.7&lt;/version&gt;
          &lt;/dependency&gt;
  
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
              &lt;version&gt;3.0.1&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet.jsp.jstl&lt;/groupId&gt;
              &lt;artifactId&gt;jstl-api&lt;/artifactId&gt;
              &lt;version&gt;1.2-rev-1&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
                      &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.web&lt;/groupId&gt;
              &lt;artifactId&gt;jstl-impl&lt;/artifactId&gt;
              &lt;version&gt;1.2&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
                      &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
  
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
              &lt;version&gt;1.7.12&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
              &lt;version&gt;1.7.12&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
              &lt;version&gt;1.16.4&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
  
          &lt;!-- Spring dependencies --&gt;
          &lt;!-- Spring 3 dependencies --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
              &lt;exclusions&gt;
                &lt;exclusion&gt;
                  &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                  &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Spring MVC --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Spring + aspects --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-aspects&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;!-- Spring Security --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-web&lt;/artifactId&gt;
              &lt;version&gt;${spring.security.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-config&lt;/artifactId&gt;
              &lt;version&gt;${spring.security.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Spring Security JSP Taglib --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-taglibs&lt;/artifactId&gt;
              &lt;version&gt;${spring.security.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;
              &lt;version&gt;4.0.1.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;!-- AWS Dependecies excluding spring --&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.amazonaws&lt;/groupId&gt;
              &lt;artifactId&gt;aws-java-sdk&lt;/artifactId&gt;
              &lt;version&gt;1.9.39&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>What is it that I am missing?</p>