Java Spring boot Application after few request 502 bad gateway

Discussão em 'StackOverflow' iniciado por Stack, Junho 30, 2021.

  1. Stack

    Stack Membro Participativo

    I am having an issue with my java spring boot application,

    application function: it's a simple HTTP post-URI application, i.e., my application will do an HTTP post call to a URI, and get the information (JSON) and send back the information, and from my API the JSON body from the URI will be sent to services.

    problem: so for the first few request, there is no issue, I will be able to get the response without any error, after few hits like after 30+ requests I am having 502 BAD Gateway. I am using the tomcat default server given by spring boot. FYI the source uri is working fine. no issues with source uri.

    the response time is 300ms-90ms

    solutions tried: changed from java.net.http to org.apache.http

    i have read online there was a limitation in tomcat, so i have even deployed this application in jboss eap and javax.servlet.api, still the error continues.

    i have closed the httpclient and CloseableHttpResponse still the error continues.

    dependencies used:

    <dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.5.13</version>
    </dependency>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <exclusions>
    <exclusion>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    </exclusion>
    <exclusion>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    </exclusion>
    </exclusions>
    </dependency>
    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
    </dependency>

    Continue reading...

Compartilhe esta Página