0

Migrated application from JRE-8 to JRE-17. Jar is build and ran on JRE-17. No code change was required. No clues why this exception occurs. Jersey version is 2.35. The same code works fine when build and ran on JRE-8

javax.ws.rs.ProcessingException: java.net.ConnectException: Connection refused
at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:269) ~[jersey-client-2.35.jar!/:?]
at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:297) ~[jersey-client-2.35.jar!/:?]
at org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$0(JerseyInvocation.java:662) ~[jersey-client-2.35.jar!/:?]
at org.glassfish.jersey.client.JerseyInvocation.call(JerseyInvocation.java:697) ~[jersey-client-2.35.jar!/:?]
at org.glassfish.jersey.client.JerseyInvocation.lambda$runInScope$3(JerseyInvocation.java:691) ~[jersey-client-2.35.jar!/:?]
at org.glassfish.jersey.internal.Errors.process(Errors.java:292) ~[jersey-common-2.35.jar!/:?]
at org.glassfish.jersey.internal.Errors.process(Errors.java:274) ~[jersey-common-2.35.jar!/:?]
at org.glassfish.jersey.internal.Errors.process(Errors.java:205) ~[jersey-common-2.35.jar!/:?]
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:390) ~[jersey-common-2.35.jar!/:?]
at org.glassfish.jersey.client.JerseyInvocation.runInScope(JerseyInvocation.java:691) ~[jersey-client-2.35.jar!/:?]
at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:661) ~[jersey-client-2.35.jar!/:?]
at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:439) ~[jersey-client-2.35.jar!/:?]
at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:345) ~[jersey-client-2.35.jar!/:?]
//removed the calling code here

Caused by: java.net.ConnectException: Connection refused
    at sun.nio.ch.Net.connect0(Native Method) ~[?:?]
    at sun.nio.ch.Net.connect(Unknown Source) ~[?:?]
    at sun.nio.ch.Net.connect(Unknown Source) ~[?:?]
    at sun.nio.ch.NioSocketImpl.connect(Unknown Source) ~[?:?]
    at java.net.Socket.connect(Unknown Source) ~[?:?]
    at sun.net.NetworkClient.doConnect(Unknown Source) ~[?:?]
    at sun.net.www.http.HttpClient.openServer(Unknown Source) ~[?:?]
    at sun.net.www.http.HttpClient$1.run(Unknown Source) ~[?:?]
    at sun.net.www.http.HttpClient$1.run(Unknown Source) ~[?:?]
    at java.security.AccessController.doPrivileged(Unknown Source) ~[?:?]
    at sun.net.www.http.HttpClient.privilegedOpenServer(Unknown Source) ~[?:?]
    at sun.net.www.http.HttpClient.openServer(Unknown Source) ~[?:?]
    at sun.net.www.http.HttpClient.<init>(Unknown Source) ~[?:?]
    at sun.net.www.http.HttpClient.New(Unknown Source) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) ~[?:?]
    at java.net.HttpURLConnection.getResponseCode(Unknown Source) ~[?:?]
    at org.glassfish.jersey.client.internal.HttpUrlConnector.handleException(HttpUrlConnector.java:549) ~[jersey-client-2.35.jar!/:?]
    at org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:375) ~[jersey-client-2.35.jar!/:?]
    at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:267) ~[jersey-client-2.35.jar!/:?]
    ... 26 more
colossal
  • 529
  • 1
  • 5
  • 22
  • Is there any other stacktraces that showed up before this one? Also, try running with `-Dsun.reflect.debugModuleAccessChecks=true` – Thiago Henrique Hupner Oct 23 '22 at 01:43
  • @ThiagoHenriqueHupner updated the stacktrace. Do you want me to run gradle build with above options Or run java application with that parameter ? – colossal Oct 23 '22 at 03:37
  • Ran the gradlew with `-Dsun.reflect.debugModuleAccessChecks=true` to build the jar but the same error persist. – colossal Oct 23 '22 at 04:07
  • Which update of JDK 8 were you using? Don't know if this is the solution, but after update 291 (April 2021), TLS 1.0 and 1.1 are disabled by default (as they are in JDK 17). I've seen network errors like this caused by that. Change the JRE_HOME/lib/security/java.security file to re-enable. – Speakjava Oct 23 '22 at 13:44
  • we were using `8_21_0_2`. Btw connection is made on http and not on https. – colossal Oct 24 '22 at 05:11

0 Answers0