Java Spring Rest Client Connection Reset Error











up vote
0
down vote

favorite












I have implemented rest client to consume a rest webservice using below code,



Client client = Client.create();
client.addFilter(new HTTPBasicAuthFilter(USERNAME,PASSWORD));
WebResource webResource = client.resource(URL);
ClientResponse clientResponse = webResource.type("application/json").accept("application/json").post(ClientResponse.class, REQUEST);


But I am facing below error,



com.sun.jersey.api.client.ClientHandlerException: java.io.IOException: Connection reset by peer
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:155)
at com.sun.jersey.api.client.filter.HTTPBasicAuthFilter.handle(HTTPBasicAuthFilter.java:105)
at com.sun.jersey.api.client.Client.handle(Client.java:652)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:570)
at org.springframework.jms.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:339)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:535)
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:495)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:241)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1056)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1048)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcherImpl.readv0(Native Method)
at sun.nio.ch.SocketDispatcher.readv(SocketDispatcher.java:43)
at sun.nio.ch.IOUtil.read(IOUtil.java:278)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:440)
at weblogic.socket.NIOInputStream.readInternal(NIOInputStream.java:148)
at weblogic.socket.NIOInputStream.read(NIOInputStream.java:90)
at weblogic.socket.NIOInputStream.read(NIOInputStream.java:73)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at weblogic.net.http.MessageHeader.isHTTP(MessageHeader.java:310)
at weblogic.net.http.MessageHeader.parseHeader(MessageHeader.java:232)
at weblogic.net.http.HttpClient.parseHTTP(HttpClient.java:554)
at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:688)
at weblogic.net.http.SOAPHttpURLConnection.getInputStream(SOAPHttpURLConnection.java:41)
at weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:1545)
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:253)
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:153)
... 17 more


But If I restart the server this issue is not appearing for some time and again it appears. Has anyone faced similar issue ? I don't get any proper solution when googled.



I am using Weblogic Server in client side and rest service is also deployed in remote weblogic server.



EDIT- When I tried with curl command in the same server where it is throwing this error, it is retrieving the results.










share|improve this question




























    up vote
    0
    down vote

    favorite












    I have implemented rest client to consume a rest webservice using below code,



    Client client = Client.create();
    client.addFilter(new HTTPBasicAuthFilter(USERNAME,PASSWORD));
    WebResource webResource = client.resource(URL);
    ClientResponse clientResponse = webResource.type("application/json").accept("application/json").post(ClientResponse.class, REQUEST);


    But I am facing below error,



    com.sun.jersey.api.client.ClientHandlerException: java.io.IOException: Connection reset by peer
    at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:155)
    at com.sun.jersey.api.client.filter.HTTPBasicAuthFilter.handle(HTTPBasicAuthFilter.java:105)
    at com.sun.jersey.api.client.Client.handle(Client.java:652)
    at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
    at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
    at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:570)
    at org.springframework.jms.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:339)
    at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:535)
    at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:495)
    at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:241)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1056)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1048)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)
    at java.lang.Thread.run(Thread.java:748)
    Caused by: java.io.IOException: Connection reset by peer
    at sun.nio.ch.FileDispatcherImpl.readv0(Native Method)
    at sun.nio.ch.SocketDispatcher.readv(SocketDispatcher.java:43)
    at sun.nio.ch.IOUtil.read(IOUtil.java:278)
    at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:440)
    at weblogic.socket.NIOInputStream.readInternal(NIOInputStream.java:148)
    at weblogic.socket.NIOInputStream.read(NIOInputStream.java:90)
    at weblogic.socket.NIOInputStream.read(NIOInputStream.java:73)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
    at weblogic.net.http.MessageHeader.isHTTP(MessageHeader.java:310)
    at weblogic.net.http.MessageHeader.parseHeader(MessageHeader.java:232)
    at weblogic.net.http.HttpClient.parseHTTP(HttpClient.java:554)
    at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:688)
    at weblogic.net.http.SOAPHttpURLConnection.getInputStream(SOAPHttpURLConnection.java:41)
    at weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:1545)
    at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:253)
    at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:153)
    ... 17 more


    But If I restart the server this issue is not appearing for some time and again it appears. Has anyone faced similar issue ? I don't get any proper solution when googled.



    I am using Weblogic Server in client side and rest service is also deployed in remote weblogic server.



    EDIT- When I tried with curl command in the same server where it is throwing this error, it is retrieving the results.










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have implemented rest client to consume a rest webservice using below code,



      Client client = Client.create();
      client.addFilter(new HTTPBasicAuthFilter(USERNAME,PASSWORD));
      WebResource webResource = client.resource(URL);
      ClientResponse clientResponse = webResource.type("application/json").accept("application/json").post(ClientResponse.class, REQUEST);


      But I am facing below error,



      com.sun.jersey.api.client.ClientHandlerException: java.io.IOException: Connection reset by peer
      at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:155)
      at com.sun.jersey.api.client.filter.HTTPBasicAuthFilter.handle(HTTPBasicAuthFilter.java:105)
      at com.sun.jersey.api.client.Client.handle(Client.java:652)
      at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
      at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
      at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:570)
      at org.springframework.jms.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:339)
      at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:535)
      at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:495)
      at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)
      at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
      at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:241)
      at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1056)
      at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1048)
      at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)
      at java.lang.Thread.run(Thread.java:748)
      Caused by: java.io.IOException: Connection reset by peer
      at sun.nio.ch.FileDispatcherImpl.readv0(Native Method)
      at sun.nio.ch.SocketDispatcher.readv(SocketDispatcher.java:43)
      at sun.nio.ch.IOUtil.read(IOUtil.java:278)
      at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:440)
      at weblogic.socket.NIOInputStream.readInternal(NIOInputStream.java:148)
      at weblogic.socket.NIOInputStream.read(NIOInputStream.java:90)
      at weblogic.socket.NIOInputStream.read(NIOInputStream.java:73)
      at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
      at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
      at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
      at weblogic.net.http.MessageHeader.isHTTP(MessageHeader.java:310)
      at weblogic.net.http.MessageHeader.parseHeader(MessageHeader.java:232)
      at weblogic.net.http.HttpClient.parseHTTP(HttpClient.java:554)
      at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:688)
      at weblogic.net.http.SOAPHttpURLConnection.getInputStream(SOAPHttpURLConnection.java:41)
      at weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:1545)
      at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:253)
      at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:153)
      ... 17 more


      But If I restart the server this issue is not appearing for some time and again it appears. Has anyone faced similar issue ? I don't get any proper solution when googled.



      I am using Weblogic Server in client side and rest service is also deployed in remote weblogic server.



      EDIT- When I tried with curl command in the same server where it is throwing this error, it is retrieving the results.










      share|improve this question















      I have implemented rest client to consume a rest webservice using below code,



      Client client = Client.create();
      client.addFilter(new HTTPBasicAuthFilter(USERNAME,PASSWORD));
      WebResource webResource = client.resource(URL);
      ClientResponse clientResponse = webResource.type("application/json").accept("application/json").post(ClientResponse.class, REQUEST);


      But I am facing below error,



      com.sun.jersey.api.client.ClientHandlerException: java.io.IOException: Connection reset by peer
      at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:155)
      at com.sun.jersey.api.client.filter.HTTPBasicAuthFilter.handle(HTTPBasicAuthFilter.java:105)
      at com.sun.jersey.api.client.Client.handle(Client.java:652)
      at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
      at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
      at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:570)
      at org.springframework.jms.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:339)
      at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:535)
      at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:495)
      at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)
      at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
      at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:241)
      at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1056)
      at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1048)
      at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)
      at java.lang.Thread.run(Thread.java:748)
      Caused by: java.io.IOException: Connection reset by peer
      at sun.nio.ch.FileDispatcherImpl.readv0(Native Method)
      at sun.nio.ch.SocketDispatcher.readv(SocketDispatcher.java:43)
      at sun.nio.ch.IOUtil.read(IOUtil.java:278)
      at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:440)
      at weblogic.socket.NIOInputStream.readInternal(NIOInputStream.java:148)
      at weblogic.socket.NIOInputStream.read(NIOInputStream.java:90)
      at weblogic.socket.NIOInputStream.read(NIOInputStream.java:73)
      at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
      at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
      at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
      at weblogic.net.http.MessageHeader.isHTTP(MessageHeader.java:310)
      at weblogic.net.http.MessageHeader.parseHeader(MessageHeader.java:232)
      at weblogic.net.http.HttpClient.parseHTTP(HttpClient.java:554)
      at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:688)
      at weblogic.net.http.SOAPHttpURLConnection.getInputStream(SOAPHttpURLConnection.java:41)
      at weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:1545)
      at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:253)
      at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:153)
      ... 17 more


      But If I restart the server this issue is not appearing for some time and again it appears. Has anyone faced similar issue ? I don't get any proper solution when googled.



      I am using Weblogic Server in client side and rest service is also deployed in remote weblogic server.



      EDIT- When I tried with curl command in the same server where it is throwing this error, it is retrieving the results.







      java spring rest weblogic






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday

























      asked yesterday









      Mojoy

      9,8883282125




      9,8883282125
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Connection reset by peer" is the TCP/IP equivalent of slamming the phone back on the hook. It's more polite than merely not replying, leaving one hanging. But it's not the FIN-ACK expected of the truly polite TCP/IP converseur.



          check here






          share|improve this answer





















          • but I see curl command is working without any issues, though from application it is throwing error.
            – Mojoy
            yesterday











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372344%2fjava-spring-rest-client-connection-reset-error%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          Connection reset by peer" is the TCP/IP equivalent of slamming the phone back on the hook. It's more polite than merely not replying, leaving one hanging. But it's not the FIN-ACK expected of the truly polite TCP/IP converseur.



          check here






          share|improve this answer





















          • but I see curl command is working without any issues, though from application it is throwing error.
            – Mojoy
            yesterday















          up vote
          0
          down vote













          Connection reset by peer" is the TCP/IP equivalent of slamming the phone back on the hook. It's more polite than merely not replying, leaving one hanging. But it's not the FIN-ACK expected of the truly polite TCP/IP converseur.



          check here






          share|improve this answer





















          • but I see curl command is working without any issues, though from application it is throwing error.
            – Mojoy
            yesterday













          up vote
          0
          down vote










          up vote
          0
          down vote









          Connection reset by peer" is the TCP/IP equivalent of slamming the phone back on the hook. It's more polite than merely not replying, leaving one hanging. But it's not the FIN-ACK expected of the truly polite TCP/IP converseur.



          check here






          share|improve this answer












          Connection reset by peer" is the TCP/IP equivalent of slamming the phone back on the hook. It's more polite than merely not replying, leaving one hanging. But it's not the FIN-ACK expected of the truly polite TCP/IP converseur.



          check here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered yesterday









          Bala555

          105




          105












          • but I see curl command is working without any issues, though from application it is throwing error.
            – Mojoy
            yesterday


















          • but I see curl command is working without any issues, though from application it is throwing error.
            – Mojoy
            yesterday
















          but I see curl command is working without any issues, though from application it is throwing error.
          – Mojoy
          yesterday




          but I see curl command is working without any issues, though from application it is throwing error.
          – Mojoy
          yesterday


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372344%2fjava-spring-rest-client-connection-reset-error%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

          SQL update select statement

          'app-layout' is not a known element: how to share Component with different Modules