title: Tomcat throws 500 error after 200 response
body: <p>I'm facing this weird issue. I have a web application deployed on Tomcat server. I'm trying to call the services of this app through postman. Some services work fine but for some Tomcat gives the below logs - </p>
  
  <pre><code>27-Sep-2018 05:33:17.773 INFO [http-nio-8080-exec-5] 
  org.glassfish.jersey.filter.LoggingFilter.log 5 * Server responded with a 
  response on thread http-nio-8080-exec-5
  5 &lt; 200
  5 &lt; Content-Type: application/json
  
  27-Sep-2018 05:33:17.867 INFO [http-nio-8080-exec-5] 
  org.glassfish.jersey.filter.LoggingFilter.log 6 * Server responded with a 
  response on thread http-nio-8080-exec-5
  6 &lt; 500
  </code></pre>
  
  <p>I searched both the server and application logs. Nothing is there to indicate the cause. And all the debug logs in my application are printed successfully which makes me think that there is no problem with my application but with the server configuration. Please help me with possible solutions.</p>
  
  <p>Web.xml - </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://java.sun.com/xml/ns/javaee"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
  id="WebApp_ID" version="3.0"&gt;
  &lt;distributable /&gt;
  &lt;display-name&gt;afrasia-services&lt;/display-name&gt;
  
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;classpath:applicationContext-rest.xml
      &lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;context-param&gt;
      &lt;param-name&gt;log4j-config-location&lt;/param-name&gt;
      &lt;param-value&gt;classpath:log4j.properties&lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.request.RequestContextListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  &lt;!-- START AUTHORIZATION: Spring OAuth2 --&gt;
  &lt;filter&gt;
      &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
      &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
  &lt;/filter&gt;
  
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  &lt;!-- END AUTHORIZATION --&gt;
  
  &lt;filter&gt;
    &lt;filter-name&gt;cors&lt;/filter-name&gt;
    &lt;filter-class&gt;com.afrAsia.filters.CORSFilter&lt;/filter-class&gt;
  &lt;/filter&gt;
  
  &lt;filter-mapping&gt;
    &lt;filter-name&gt;cors&lt;/filter-name&gt;
    &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  
  
  &lt;!-- servlet&gt; &lt;servlet-name&gt;DigitalTransaction&lt;/servlet-name&gt; &lt;servlet-class&gt;com.sun.xml.ws.transport.http.servlet.WSSpringServlet&lt;/servlet-class&gt; 
      &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;DigitalTransaction&lt;/servlet-name&gt; 
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/servlet-mapping --&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;REST-Project&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.glassfish.jersey.servlet.ServletContainer&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;jersey.config.server.provider.packages&lt;/param-name&gt;
          &lt;param-value&gt;com.afrAsia.rest,com.fasterxml.jackson.jaxrs.json&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;jersey.config.server.provider.classnames&lt;/param-name&gt;
          &lt;param-value&gt;org.glassfish.jersey.filter.LoggingFilter;org.glassfish.jersey.media.multipart.MultiPartFeature&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
      &lt;param-name&gt;dispatchOptionsRequest&lt;/param-name&gt;
          &lt;param-value&gt;true&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;REST-Project&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;spring&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;spring&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/oauth/token&lt;/url-pattern&gt;
      &lt;url-pattern&gt;/*/request_otp&lt;/url-pattern&gt;
      &lt;url-pattern&gt;/*/sign_in&lt;/url-pattern&gt;
      &lt;url-pattern&gt;/*/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>