0

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 -

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 < 200
5 < 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 < 500

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.

Web.xml -

<?xml version="1.0" encoding="UTF-8"?>
<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">
<distributable />
<display-name>afrasia-services</display-name>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext-rest.xml
    </param-value>
</context-param>

<context-param>
    <param-name>log4j-config-location</param-name>
    <param-value>classpath:log4j.properties</param-value>
</context-param>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>

<!-- START AUTHORIZATION: Spring OAuth2 -->
<filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>

<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<!-- END AUTHORIZATION -->

<filter>
  <filter-name>cors</filter-name>
  <filter-class>com.afrAsia.filters.CORSFilter</filter-class>
</filter>

<filter-mapping>
  <filter-name>cors</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>


<!-- servlet> <servlet-name>DigitalTransaction</servlet-name> <servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</servlet-class> 
    </servlet> <servlet-mapping> <servlet-name>DigitalTransaction</servlet-name> 
    <url-pattern>/*</url-pattern> </servlet-mapping -->

<servlet>
    <servlet-name>REST-Project</servlet-name>
    <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
    <init-param>
        <param-name>jersey.config.server.provider.packages</param-name>
        <param-value>com.afrAsia.rest,com.fasterxml.jackson.jaxrs.json</param-value>
    </init-param>
    <init-param>
        <param-name>jersey.config.server.provider.classnames</param-name>
        <param-value>org.glassfish.jersey.filter.LoggingFilter;org.glassfish.jersey.media.multipart.MultiPartFeature</param-value>
    </init-param>
    <init-param>
    <param-name>dispatchOptionsRequest</param-name>
        <param-value>true</param-value>
        </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>REST-Project</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

<servlet>
    <servlet-name>spring</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>



<servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>/oauth/token</url-pattern>
    <url-pattern>/*/request_otp</url-pattern>
    <url-pattern>/*/sign_in</url-pattern>
    <url-pattern>/*/*</url-pattern>
</servlet-mapping>
</web-app>
Avisha
  • 41
  • 12
  • [1] Please add a Jersey tag to your post. [2] See [Why does jersey have no error log when the status is 500?](https://stackoverflow.com/q/27854367/2985643) regarding the absence of a stack trace for the 500 error in the log. – skomisa Sep 27 '18 at 17:55
  • i tried the ExceptionMapper Solution and also other filters that catch the response before sending it to the frontend but nothing is able to catch the 500 response. They only catch the 200 response. I tried using an older version of Tomcat also. But that didn't work too. I think there is some issue with my web.xml. – Avisha Sep 28 '18 at 06:22
  • [1] OK, so update your post with **web.xml**. [2] Which version of Tomcat are you using? – skomisa Sep 28 '18 at 11:44
  • I've updated my post with web.xml and i tried apache-tomcat-7.0.91-windows-x64 and apache-tomcat-9.0.0.M19-windows-x64 versions – Avisha Sep 28 '18 at 11:52
  • Your **web.xml** file does not have a closing `` tag. – skomisa Sep 28 '18 at 12:21
  • Sorry, It was just a typo error here. The tag is there in my original xml. – Avisha Sep 28 '18 at 14:32

0 Answers0