javax.ws.rs.ProcessingException: Already connected

Java.net JIRA | vksavochkin | 2 years ago
  1. 0

    When connecting to https endpoint, jersey throws this useless IllegalStateException instead of original javax.net.ssl.SSLHandshakeException: {code} javax.ws.rs.ProcessingException: Already connected at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:255) at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:667) at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:664) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:228) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:424) at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:664) at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:424) at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:333) at my.test.TestService.foo(TestService.java:65) ... Caused by: java.lang.IllegalStateException: Already connected at sun.net.www.protocol.http.HttpURLConnection.setRequestProperty(HttpURLConnection.java:3000) at sun.net.www.protocol.https.HttpsURLConnectionImpl.setRequestProperty(HttpsURLConnectionImpl.java:316) at org.glassfish.jersey.client.HttpUrlConnector.setOutboundHeaders(HttpUrlConnector.java:348) at org.glassfish.jersey.client.HttpUrlConnector.access$100(HttpUrlConnector.java:87) at org.glassfish.jersey.client.HttpUrlConnector$3.getOutputStream(HttpUrlConnector.java:311) at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:200) at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:194) at org.glassfish.jersey.message.internal.CommittingOutputStream.commit(CommittingOutputStream.java:262) at org.glassfish.jersey.message.internal.OutboundMessageContext.commitStream(OutboundMessageContext.java:811) at org.glassfish.jersey.client.ClientRequest.writeEntity(ClientRequest.java:546) at org.glassfish.jersey.client.HttpUrlConnector._apply(HttpUrlConnector.java:315) at org.glassfish.jersey.client.HttpUrlConnector.apply(HttpUrlConnector.java:227) at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:246) ... 32 more {code} I think, org.glassfish.jersey.client.ClientRequest#writeEntity should catch all exceptions not just IOException when logging close() errors in "finally" block. Also, SSLException should be treated like a ConnectException.

    Java.net JIRA | 2 years ago | vksavochkin
    javax.ws.rs.ProcessingException: Already connected
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    When connecting to https endpoint, jersey throws this useless IllegalStateException instead of original javax.net.ssl.SSLHandshakeException: {code} javax.ws.rs.ProcessingException: Already connected at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:255) at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:667) at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:664) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:228) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:424) at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:664) at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:424) at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:333) at my.test.TestService.foo(TestService.java:65) ... Caused by: java.lang.IllegalStateException: Already connected at sun.net.www.protocol.http.HttpURLConnection.setRequestProperty(HttpURLConnection.java:3000) at sun.net.www.protocol.https.HttpsURLConnectionImpl.setRequestProperty(HttpsURLConnectionImpl.java:316) at org.glassfish.jersey.client.HttpUrlConnector.setOutboundHeaders(HttpUrlConnector.java:348) at org.glassfish.jersey.client.HttpUrlConnector.access$100(HttpUrlConnector.java:87) at org.glassfish.jersey.client.HttpUrlConnector$3.getOutputStream(HttpUrlConnector.java:311) at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:200) at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:194) at org.glassfish.jersey.message.internal.CommittingOutputStream.commit(CommittingOutputStream.java:262) at org.glassfish.jersey.message.internal.OutboundMessageContext.commitStream(OutboundMessageContext.java:811) at org.glassfish.jersey.client.ClientRequest.writeEntity(ClientRequest.java:546) at org.glassfish.jersey.client.HttpUrlConnector._apply(HttpUrlConnector.java:315) at org.glassfish.jersey.client.HttpUrlConnector.apply(HttpUrlConnector.java:227) at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:246) ... 32 more {code} I think, org.glassfish.jersey.client.ClientRequest#writeEntity should catch all exceptions not just IOException when logging close() errors in "finally" block. Also, SSLException should be treated like a ConnectException.

    Java.net JIRA | 2 years ago | vksavochkin
    javax.ws.rs.ProcessingException: Already connected
  4. 0

    Jersey - can't use client with SSL

    nabble.com | 11 months ago
    javax.ws.rs.ProcessingException: Already connected

    23 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. javax.ws.rs.ProcessingException

      Already connected

      at org.glassfish.jersey.client.ClientRuntime.invoke()
    2. jersey-core-client
      JerseyInvocation$1.call
      1. org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:255)
      2. org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:667)
      3. org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:664)
      3 frames
    3. Jersey Core
      RequestScope.runInScope
      1. org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      2. org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      3. org.glassfish.jersey.internal.Errors.process(Errors.java:228)
      4. org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:424)
      4 frames
    4. jersey-core-client
      JerseyInvocation$Builder.post
      1. org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:664)
      2. org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:424)
      3. org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:333)
      3 frames
    5. my.test
      TestService.foo
      1. my.test.TestService.foo(TestService.java:65)
      1 frame