javax.ws.rs.ProcessingException: Already connected Intermittently

96 Views Asked by At

using Java code that connects to the API gateway to make a post call. All are working fine. Sometimes I start getting an "already connected exception. Restarting ECS tasks resolves this issue, but then it starts coming again after some time.

Logs below.

2023-03-23T18:13:34.332+05:30   javax.ws.rs.ProcessingException: Already connected

2023-03-23T18:13:34.332+05:30   at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:264) ~[jersey-client.jar:?]

2023-03-23T18:13:34.332+05:30   at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:684) ~[jersey-client.jar:?]

2023-03-23T18:13:34.332+05:30   at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:681) ~[jersey-client.jar:?]

2023-03-23T18:13:34.332+05:30   at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[jersey-common.jar:?]

2023-03-23T18:13:34.332+05:30   at org.glassfish.jersey.internal.Errors.process(Errors.java:297) ~[jersey-common.jar:?]

2023-03-23T18:13:34.332+05:30   at org.glassfish.jersey.internal.Errors.process(Errors.java:228) ~[jersey-common.jar:?]

2023-03-23T18:13:34.332+05:30   at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:444) ~[jersey-common.jar:?]

2023-03-23T18:13:34.332+05:30   at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:681) ~[jersey-client.jar:?]

2023-03-23T18:13:34.332+05:30   at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:437) ~[jersey-client.jar:?]

2023-03-23T18:13:34.332+05:30   at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:343) ~[jersey-client.jar:?]

2023-03-23T18:13:34.332+05:30   at com.xxy.controller.activity.ABActivity.ABDetails(ABC.java:54) ~[-1.0.jar:?]

Code I am using to connect is

 WebTarget target = FrontHelper.getTarget(URI + POST_API_URI,
                    AppConfig.findString("abc.accessrole.arn"),REGION,AWS_SERVICE,
                    SessionCredentialsGenerator.getInstance().getABCCredentials());
            Invocation.Builder builder = target.request(MediaType.APPLICATION_JSON);
            Response response = builder.post(Entity.entity(requestObj, MediaType.APPLICATION_JSON));
            InputStream streamingResponse = response.readEntity(InputStream.class);
            int status = response.getStatus();

I am able to get response most of the times. I am not able to figure out why it is coming only few times.

I tried a lot searching about this issue. found nothing. Also upgraded jersy client version.

I tried a lot searching about this issue. found nothing. Also upgraded jersy client version.

0

There are 0 best solutions below