title: Spring Boot ErrorController not working with OpenShift
body: <p>I am trying to send a standard error response when the request is not fulfilled on the server due to any reason. For that, I implemented ErrorController interface and overridden getErrorPath method. It's working on my local machine but when I deploy that onto the OpenShift server with Tomcat 7.0.54. It does not work it show this exception instead of showing the json reponse : </p>
  
  <pre><code>    HTTP Status 500 - org.springframework.web.context.request.async.WebAsyncManager cannot be cast to org.springframework.web.context.request.async.WebAsyncManager
  
      type Exception report
  
      message org.springframework.web.context.request.async.WebAsyncManager cannot be cast to org.springframework.web.context.request.async.WebAsyncManager
  
      description The server encountered an internal error that prevented it from fulfilling this request.
  
      exception
  
      java.lang.ClassCastException: org.springframework.web.context.request.async.WebAsyncManager cannot be cast to org.springframework.web.context.request.async.WebAsyncManager
          org.springframework.web.context.request.async.WebAsyncUtils.getAsyncManager(WebAsyncUtils.java:47)
          org.springframework.web.filter.OncePerRequestFilter.isAsyncDispatch(OncePerRequestFilter.java:137)
          org.springframework.web.filter.OncePerRequestFilter.skipDispatch(OncePerRequestFilter.java:118)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:98)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
          org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:112)
          org.springframework.boot.web.support.ErrorPageFilter.forwardToErrorPage(ErrorPageFilter.java:187)
          org.springframework.boot.web.support.ErrorPageFilter.handleException(ErrorPageFilter.java:170)
          org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:134)
          org.springframework.boot.web.support.ErrorPageFilter.access$000(ErrorPageFilter.java:61)
          org.springframework.boot.web.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:94)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
          org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:112)    
  </code></pre>
  
  <p>Here is what I did :</p>
  
  <p>Application.java</p>
  
  <pre><code>    import org.apache.catalina.Context;
      import org.apache.catalina.deploy.ContextResource;
      import org.apache.catalina.startup.Tomcat;
      import org.apache.log4j.Logger;
      import org.springframework.boot.SpringApplication;
      import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
      import org.springframework.boot.autoconfigure.SpringBootApplication;
      import org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration;
      import org.springframework.boot.builder.SpringApplicationBuilder;
      import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
      import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer;
      import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
      import org.springframework.boot.web.support.SpringBootServletInitializer;
      import org.springframework.context.annotation.Bean;
      import org.springframework.jndi.JndiObjectFactoryBean;
  
      @SpringBootApplication
      public class Application extends SpringBootServletInitializer{
  
          private static final Logger LOGGER = Logger.getLogger(Application.class);
  
          public static void main(String[] args) {
              LOGGER.info("Spring Boot Application Started");
              SpringApplication.run(Application.class, args);
              LOGGER.info("Spring Boot Application Ended");
          }
  
          @Override
          protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
              return application.sources(Application.class);
          }
  
          @Bean
          public EmbeddedServletContainerFactory tomcatFactory() {
              return new TomcatEmbeddedServletContainerFactory() {
  
                  @Override
                  protected TomcatEmbeddedServletContainer getTomcatEmbeddedServletContainer(Tomcat tomcat) {
                      tomcat.enableNaming();
                      return super.getTomcatEmbeddedServletContainer(tomcat);
                  }
              };
          }
      }   
  </code></pre>
  
  <p>ErrorJson.java</p>
  
  <pre><code>import java.util.Map;
  
  public class ErrorJson {
  
  public Integer status;
  public String error;
  public String message;
  public String timeStamp;
  
  public ErrorJson(int status, Map&lt;String, Object&gt; errorAttributes) {
      this.status = status;
      this.error = (String) errorAttributes.get("error");
      this.message = "Please Contact the Administrator for more detail.";
      this.timeStamp = errorAttributes.get("timestamp").toString();
  }
  }
  </code></pre>
  
  <p>CustomErrorController.java</p>
  
  <pre><code>    import org.springframework.beans.factory.annotation.Autowired;
      import org.springframework.beans.factory.annotation.Value;
      import org.springframework.boot.autoconfigure.web.ErrorAttributes;
      import org.springframework.boot.autoconfigure.web.ErrorController;
      import org.springframework.web.bind.annotation.RequestMapping;
      import org.springframework.web.bind.annotation.RestController;
      import org.springframework.web.context.request.RequestAttributes;
      import org.springframework.web.context.request.ServletRequestAttributes;
  
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      import java.util.Map;
  
      @RestController
      public class CustomErrorController implements ErrorController {
  
          private static final String PATH = "/error";
  
          @Autowired
          private ErrorAttributes errorAttributes;
  
          @RequestMapping(value = PATH)
          ErrorJson error(HttpServletRequest request, HttpServletResponse response) {
              // Appropriate HTTP response code (e.g. 404 or 500) is automatically set by Spring. 
              // Here we just define response body.
              return new ErrorJson(response.getStatus(), getErrorAttributes(request));
          }
  
          @Override
          public String getErrorPath() {
              return PATH;
          }
  
          private Map&lt;String, Object&gt; getErrorAttributes(HttpServletRequest request) {
              RequestAttributes requestAttributes = new ServletRequestAttributes(request);
              return errorAttributes.getErrorAttributes(requestAttributes,true);
          }
  
      }
  </code></pre>
  
  <p>POM.xml</p>
  
  <pre><code>    &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
          &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
          &lt;artifactId&gt;tomcat7&lt;/artifactId&gt;
          &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
          &lt;packaging&gt;war&lt;/packaging&gt;
  
          &lt;name&gt;newapp-tomcat7&lt;/name&gt;
  
          &lt;parent&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
              &lt;version&gt;1.4.1.RELEASE&lt;/version&gt;
          &lt;/parent&gt;
  
          &lt;properties&gt;
              &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
              &lt;java.version&gt;1.7&lt;/java.version&gt;
              &lt;tomcat.version&gt;7.0.54&lt;/tomcat.version&gt;
              &lt;json-simple.version&gt;1.1.1&lt;/json-simple.version&gt;
              &lt;commons-codec.verison&gt;1.10&lt;/commons-codec.verison&gt;
              &lt;log4j-core.version&gt;2.4.1&lt;/log4j-core.version&gt;
              &lt;log4j-api.version&gt;2.4.1&lt;/log4j-api.version&gt;
          &lt;/properties&gt;
  
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.session&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-session&lt;/artifactId&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.session&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-session-jdbc&lt;/artifactId&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-starter-freemarker&lt;/artifactId&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-starter-mail&lt;/artifactId&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-starter-jdbc&lt;/artifactId&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-starter-jersey&lt;/artifactId&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
                  &lt;exclusions&gt;
                      &lt;exclusion&gt;
                          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                          &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
                      &lt;/exclusion&gt;
                  &lt;/exclusions&gt;
              &lt;/dependency&gt;
              &lt;!-- &lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt; 
                  &lt;/dependency&gt; --&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
                  &lt;scope&gt;test&lt;/scope&gt;
              &lt;/dependency&gt;
              &lt;!-- http://mvnrepository.com/artifact/commons-codec/commons-codec --&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;commons-codec&lt;/groupId&gt;
                  &lt;artifactId&gt;commons-codec&lt;/artifactId&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;com.googlecode.json-simple&lt;/groupId&gt;
                  &lt;artifactId&gt;json-simple&lt;/artifactId&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.json&lt;/groupId&gt;
                  &lt;artifactId&gt;json&lt;/artifactId&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
                  &lt;artifactId&gt;log4j-core&lt;/artifactId&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
                  &lt;artifactId&gt;log4j-api&lt;/artifactId&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                  &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;junit&lt;/groupId&gt;
                  &lt;artifactId&gt;junit&lt;/artifactId&gt;
                  &lt;scope&gt;test&lt;/scope&gt;
              &lt;/dependency&gt;
  
              &lt;!-- Dependencies added for WAS and Oracle --&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;com.oracle&lt;/groupId&gt;
                  &lt;artifactId&gt;classes12&lt;/artifactId&gt;
                  &lt;version&gt;10.2.0.5&lt;/version&gt;
                  &lt;scope&gt;provided&lt;/scope&gt;
              &lt;/dependency&gt;
              &lt;!-- &lt;dependency&gt; &lt;groupId&gt;com.oracle&lt;/groupId&gt; &lt;artifactId&gt;ojdbc6&lt;/artifactId&gt; 
                  &lt;version&gt;11.2.0.3&lt;/version&gt; &lt;scope&gt;provided&lt;/scope&gt; &lt;/dependency&gt; --&gt;
  
              &lt;dependency&gt;
                  &lt;groupId&gt;com.oracle&lt;/groupId&gt;
                  &lt;artifactId&gt;ojdbc14&lt;/artifactId&gt;
                  &lt;version&gt;10.2.0.5&lt;/version&gt;
              &lt;/dependency&gt;
  
              &lt;!-- Dependencies WAS and Oracle ends --&gt;
  
              &lt;!-- Server Dependency --&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
                  &lt;artifactId&gt;tomcat-juli&lt;/artifactId&gt;
                  &lt;version&gt;${tomcat.version}&lt;/version&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
                  &lt;artifactId&gt;tomcat-dbcp&lt;/artifactId&gt;
                  &lt;version&gt;${tomcat.version}&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;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
                  &lt;artifactId&gt;tomcat-jdbc&lt;/artifactId&gt;
              &lt;/dependency&gt;
              &lt;!-- Server Dependency ends --&gt;
  
          &lt;/dependencies&gt;
  
          &lt;build&gt;
              &lt;finalName&gt;cctgmap&lt;/finalName&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
                      &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
                      &lt;version&gt;2.2&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;server&gt;TomcatServer&lt;/server&gt;
                          &lt;port&gt;8008&lt;/port&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
                      &lt;version&gt;2.4&lt;/version&gt;
                      &lt;executions&gt;
                          &lt;execution&gt;
                              &lt;phase&gt;package&lt;/phase&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;single&lt;/goal&gt;
                              &lt;/goals&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                      &lt;configuration&gt;
                          &lt;appendAssemblyId&gt;false&lt;/appendAssemblyId&gt;
                          &lt;descriptors&gt;
                              &lt;descriptor&gt;assembly.xml&lt;/descriptor&gt;
                          &lt;/descriptors&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
                  &lt;plugin&gt;
                      &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
                      &lt;version&gt;2.1.1&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;outputDirectory&gt;${project.build.directory}/../package/dependencies/jbossews/webapps &lt;/outputDirectory&gt;
                          &lt;warName&gt;ROOT&lt;/warName&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/build&gt;
      &lt;/project&gt;
  </code></pre>
  
  <p>I found this when I was searching only for solution:
  <a href="https://jira.atlassian.com/browse/CWD-4770" rel="nofollow noreferrer">https://jira.atlassian.com/browse/CWD-4770</a></p>
  
  <p>But it does not make sense. </p>
  
  <p>If I run <strong>mvn dependency:tree</strong> I get this:</p>
  
  <pre><code>    [INFO] +- org.springframework.session:spring-session:jar:1.2.2.RELEASE:compile
      [INFO] |  \- commons-logging:commons-logging:jar:1.2:compile
      [INFO] +- org.springframework.session:spring-session-jdbc:jar:1.2.2.RELEASE:compile
      [INFO] |  \- org.springframework:spring-jdbc:jar:4.3.3.RELEASE:compile
      [INFO] |     +- org.springframework:spring-beans:jar:4.3.3.RELEASE:compile
      [INFO] |     \- org.springframework:spring-tx:jar:4.3.3.RELEASE:compile
      [INFO] +- org.springframework.boot:spring-boot-starter-freemarker:jar:1.4.1.RELEASE:compile
      [INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.4.1.RELEASE:compile
      [INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.4.1.RELEASE:compile
      [INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.4.1.RELEASE:compile
      [INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.4.1.RELEASE:compile
      [INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.1.7:compile
      [INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.1.7:compile
      [INFO] |  |  |  +- org.slf4j:jcl-over-slf4j:jar:1.7.21:compile
      [INFO] |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.21:compile
      [INFO] |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.21:compile
      [INFO] |  |  \- org.yaml:snakeyaml:jar:1.17:runtime
      [INFO] |  +- org.freemarker:freemarker:jar:2.3.25-incubating:compile
      [INFO] |  \- org.springframework:spring-context-support:jar:4.3.3.RELEASE:compile
      [INFO] +- org.springframework.boot:spring-boot-starter-mail:jar:1.4.1.RELEASE:compile
      [INFO] |  +- org.springframework:spring-context:jar:4.3.3.RELEASE:compile
      [INFO] |  |  +- org.springframework:spring-aop:jar:4.3.3.RELEASE:compile
      [INFO] |  |  \- org.springframework:spring-expression:jar:4.3.3.RELEASE:compile
      [INFO] |  \- com.sun.mail:javax.mail:jar:1.5.6:compile
      [INFO] |     \- javax.activation:activation:jar:1.1:compile
      [INFO] +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.4.1.RELEASE:compile
      [INFO] +- org.springframework.boot:spring-boot-starter-jersey:jar:1.4.1.RELEASE:compile
      [INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.4.1.RELEASE:compile
      [INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:7.0.59:compile
      [INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:7.0.59:compile
      [INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:7.0.59:compile
      [INFO] |  +- org.springframework.boot:spring-boot-starter-validation:jar:1.4.1.RELEASE:compile
      [INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.3:compile
      [INFO] |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.3:compile
      [INFO] |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.3:compile
      [INFO] |  +- org.springframework:spring-web:jar:4.3.3.RELEASE:compile
      [INFO] |  +- org.glassfish.jersey.core:jersey-server:jar:2.23.2:compile
      [INFO] |  |  +- org.glassfish.jersey.core:jersey-common:jar:2.23.2:compile
      [INFO] |  |  |  +- org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.23.2:compile
      [INFO] |  |  |  \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
      [INFO] |  |  +- org.glassfish.jersey.core:jersey-client:jar:2.23.2:compile
      [INFO] |  |  +- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
      [INFO] |  |  +- org.glassfish.jersey.media:jersey-media-jaxb:jar:2.23.2:compile
      [INFO] |  |  +- javax.annotation:javax.annotation-api:jar:1.2:compile
      [INFO] |  |  +- org.glassfish.hk2:hk2-api:jar:2.5.0-b05:compile
      [INFO] |  |  |  +- org.glassfish.hk2:hk2-utils:jar:2.5.0-b05:compile
      [INFO] |  |  |  \- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b05:compile
      [INFO] |  |  +- org.glassfish.hk2.external:javax.inject:jar:2.5.0-b05:compile
      [INFO] |  |  +- org.glassfish.hk2:hk2-locator:jar:2.5.0-b05:compile
      [INFO] |  |  |  \- org.javassist:javassist:jar:3.20.0-GA:compile
      [INFO] |  |  \- javax.validation:validation-api:jar:1.1.0.Final:compile
      [INFO] |  +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.23.2:compile
      [INFO] |  +- org.glassfish.jersey.containers:jersey-container-servlet:jar:2.23.2:compile
      [INFO] |  +- org.glassfish.jersey.ext:jersey-bean-validation:jar:2.23.2:compile
      [INFO] |  +- org.glassfish.jersey.ext:jersey-spring3:jar:2.23.2:compile
      [INFO] |  |  +- org.glassfish.hk2:hk2:jar:2.5.0-b05:compile
      [INFO] |  |  |  +- org.glassfish.hk2:config-types:jar:2.5.0-b05:compile
      [INFO] |  |  |  +- org.glassfish.hk2:hk2-core:jar:2.5.0-b05:compile
      [INFO] |  |  |  +- org.glassfish.hk2:hk2-config:jar:2.5.0-b05:compile
      [INFO] |  |  |  +- org.glassfish.hk2:hk2-runlevel:jar:2.5.0-b05:compile
      [INFO] |  |  |  \- org.glassfish.hk2:class-model:jar:2.5.0-b05:compile
      [INFO] |  |  |     \- org.glassfish.hk2.external:asm-all-repackaged:jar:2.5.0-b05:compile
      [INFO] |  |  \- org.glassfish.hk2:spring-bridge:jar:2.5.0-b05:compile
      [INFO] |  \- org.glassfish.jersey.media:jersey-media-json-jackson:jar:2.23.2:compile
      [INFO] |     +- org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.23.2:compile
      [INFO] |     +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.8.3:compile
      [INFO] |     \- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.8.3:compile
      [INFO] |        \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.8.3:compile
      [INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:1.4.1.RELEASE:compile
      [INFO] |  \- org.springframework.boot:spring-boot-actuator:jar:1.4.1.RELEASE:compile
      [INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.4.1.RELEASE:compile
      [INFO] |  +- org.hibernate:hibernate-validator:jar:5.2.4.Final:compile
      [INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
      [INFO] |  |  \- com.fasterxml:classmate:jar:1.3.1:compile
      [INFO] |  \- org.springframework:spring-webmvc:jar:4.3.3.RELEASE:compile
      [INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.4.1.RELEASE:test
      [INFO] |  +- org.springframework.boot:spring-boot-test:jar:1.4.1.RELEASE:test
      [INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.4.1.RELEASE:test
      [INFO] |  +- com.jayway.jsonpath:json-path:jar:2.2.0:test
      [INFO] |  |  \- net.minidev:json-smart:jar:2.2.1:test
      [INFO] |  |     \- net.minidev:accessors-smart:jar:1.1:test
      [INFO] |  |        \- org.ow2.asm:asm:jar:5.0.3:test
      [INFO] |  +- org.assertj:assertj-core:jar:2.5.0:test
      [INFO] |  +- org.mockito:mockito-core:jar:1.10.19:test
      [INFO] |  |  \- org.objenesis:objenesis:jar:2.1:test
      [INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:test
      [INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
      [INFO] |  +- org.skyscreamer:jsonassert:jar:1.3.0:test
      [INFO] |  +- org.springframework:spring-core:jar:4.3.3.RELEASE:compile
      [INFO] |  \- org.springframework:spring-test:jar:4.3.3.RELEASE:test
      [INFO] +- commons-codec:commons-codec:jar:1.10:compile
      [INFO] +- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
      [INFO] +- org.json:json:jar:20140107:compile
      [INFO] +- org.apache.logging.log4j:log4j-core:jar:2.6.2:compile
      [INFO] +- org.apache.logging.log4j:log4j-api:jar:2.6.2:compile
      [INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.21:compile
      [INFO] |  +- org.slf4j:slf4j-api:jar:1.7.21:compile
      [INFO] |  \- log4j:log4j:jar:1.2.17:compile
      [INFO] +- junit:junit:jar:4.12:test
      [INFO] +- com.oracle:classes12:jar:10.2.0.5:provided
      [INFO] +- com.oracle:ojdbc14:jar:10.2.0.5:compile
      [INFO] +- org.apache.tomcat:tomcat-juli:jar:7.0.59:compile
      [INFO] +- org.apache.tomcat:tomcat-dbcp:jar:7.0.59:compile
      [INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
      [INFO] \- org.apache.tomcat:tomcat-jdbc:jar:7.0.59:compile
  </code></pre>
  
  <p>Added Filter </p>
  
  <pre><code>    import org.apache.log4j.Logger;
      import org.springframework.core.Ordered;  
      import org.springframework.core.annotation.Order;  
      import org.springframework.stereotype.Component;
      import org.springframework.web.context.request.async.WebAsyncUtils;
  
      import javax.servlet.*;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;  
      import java.io.IOException;  
  
      @Component  
      @Order(Ordered.HIGHEST_PRECEDENCE)  
      public class SecurityFilter implements Filter {  
  
          private static final Logger LOGGER = Logger.getLogger(SecurityFilter.class);
  
          @Override  
          public void init(FilterConfig filterConfig) throws ServletException {  
  
          }  
  
          @Override  
          public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {  
              if (request.getAttribute(WebAsyncUtils.WEB_ASYNC_MANAGER_ATTRIBUTE) != null) {
               request.setAttribute(WebAsyncUtils.WEB_ASYNC_MANAGER_ATTRIBUTE, null);
              }    
              LOGGER.info("Filter "+((HttpServletRequest) request).getRequestURL().toString());
              chain.doFilter(request,response);  
          }  
  
          @Override  
          public void destroy() {  
  
          }  
      } 
  </code></pre>
  
  <p>But still it not working its showing me this exception: </p>
  
  <pre><code>    Type Exception report
  
      message Request processing failed; nested exception is java.lang.ClassCastException: org.springframework.web.context.request.async.WebAsyncManager cannot be cast to org.springframework.web.context.request.async.WebAsyncManager
  
      description The server encountered an internal error that prevented it from fulfilling this request.
  
      exception
  
      org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.ClassCastException: org.springframework.web.context.request.async.WebAsyncManager cannot be cast to org.springframework.web.context.request.async.WebAsyncManager
          org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
          org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
          org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
          org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
          org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
          org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:105)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
          org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
          org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:89)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
          org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
          org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:164)
          org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80)
          org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
          org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:107)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
          com.cisco.eloqua.app.SecurityFilter.doFilter(SecurityFilter.java:31)
      root cause
  
      java.lang.ClassCastException: org.springframework.web.context.request.async.WebAsyncManager cannot be cast to org.springframework.web.context.request.async.WebAsyncManager
          org.springframework.web.context.request.async.WebAsyncUtils.getAsyncManager(WebAsyncUtils.java:47)
          org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:900)
          org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
          org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
          org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
          org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
          org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
          org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:105)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
          org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
          org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:89)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
          org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
          org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:164)
          org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80)
          org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
          org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:107)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
          com.cisco.eloqua.app.SecurityFilter.doFilter(SecurityFilter.java:31)
      note The full stack trace of the root cause is available in the Apache Tomcat/7.0.54 logs.
  
      Apache Tomcat/7.0.54
  </code></pre>