org.springframework.web.client.ResourceAccessException: I/O error: null; nested exception is java.io.EOFException

Spring JIRA | Kay Janssen | 3 years ago
  1. 0

    occasional java.io.EOFException when using @Post

    GitHub | 3 years ago | dodgex
    org.springframework.web.client.ResourceAccessException: I/O error: null; nested exception is java.io.EOFException
  2. 0

    When using spring template to do a POST request, sometimes there is an org.springframework.web.client.ResourceAccessException , caused by a java.io.EOFException. my research results are pretty clear: its a "bug" in androids http client stuff. i found some workarround on StackOverflow that suggests using another requestfactory for spring rest tempalte. so i implemented a requestfactory using OkHttp. (see the gist in referenced URL) as i didn't wanted to have this in the org.springframework classpath i also had to make a Request and a Response class. all classes are based on your SimpleXXX variants. Here is the full stacktrace: A runtime exception was thrown while executing code in a background task org.springframework.web.client.ResourceAccessException: I/O error: null; nested exception is java.io.EOFException at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:491) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:439) at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:415) at org.test.service.rest.RestApi_.sendGreeting(RestApi_.java:91) at org.test.activities.TestActivity.send(TestActivity.java:89) at org.test.activities.TestActivity_.access$101(TestActivity_.java:29) at org.test.activities.TestActivity_$4.execute(TestActivity_.java:160) at org.androidannotations.api.BackgroundExecutor$Task.run(BackgroundExecutor.java:302) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390) at java.util.concurrent.FutureTask.run(FutureTask.java:234) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:153) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:856) Caused by: java.io.EOFException at libcore.io.Streams.readAsciiLine(Streams.java:203) at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:573) at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:821) at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283) at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:495) at org.springframework.http.client.SimpleClientHttpResponse.getRawStatusCode(SimpleClientHttpResponse.java:54) at org.springframework.http.client.SimpleClientHttpResponse.getStatusCode(SimpleClientHttpResponse.java:80) at org.springframework.web.client.DefaultResponseErrorHandler.hasError(DefaultResponseErrorHandler.java:46) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:477) ... 14 more

    Spring JIRA | 3 years ago | Kay Janssen
    org.springframework.web.client.ResourceAccessException: I/O error: null; nested exception is java.io.EOFException
  3. 0

    When using spring template to do a POST request, sometimes there is an org.springframework.web.client.ResourceAccessException , caused by a java.io.EOFException. my research results are pretty clear: its a "bug" in androids http client stuff. i found some workarround on StackOverflow that suggests using another requestfactory for spring rest tempalte. so i implemented a requestfactory using OkHttp. (see the gist in referenced URL) as i didn't wanted to have this in the org.springframework classpath i also had to make a Request and a Response class. all classes are based on your SimpleXXX variants. Here is the full stacktrace: A runtime exception was thrown while executing code in a background task org.springframework.web.client.ResourceAccessException: I/O error: null; nested exception is java.io.EOFException at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:491) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:439) at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:415) at org.test.service.rest.RestApi_.sendGreeting(RestApi_.java:91) at org.test.activities.TestActivity.send(TestActivity.java:89) at org.test.activities.TestActivity_.access$101(TestActivity_.java:29) at org.test.activities.TestActivity_$4.execute(TestActivity_.java:160) at org.androidannotations.api.BackgroundExecutor$Task.run(BackgroundExecutor.java:302) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390) at java.util.concurrent.FutureTask.run(FutureTask.java:234) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:153) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:856) Caused by: java.io.EOFException at libcore.io.Streams.readAsciiLine(Streams.java:203) at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:573) at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:821) at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283) at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:495) at org.springframework.http.client.SimpleClientHttpResponse.getRawStatusCode(SimpleClientHttpResponse.java:54) at org.springframework.http.client.SimpleClientHttpResponse.getStatusCode(SimpleClientHttpResponse.java:80) at org.springframework.web.client.DefaultResponseErrorHandler.hasError(DefaultResponseErrorHandler.java:46) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:477) ... 14 more

    Spring JIRA | 3 years ago | Kay Janssen
    org.springframework.web.client.ResourceAccessException: I/O error: null; nested exception is java.io.EOFException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Spring Rest Template usage causes EOFException

    Stack Overflow | 4 years ago | Sebastian Roth
    org.springframework.web.client.ResourceAccessException: I/O error: null; nested exception is java.io.EOFException
  6. 0

    HessianConnectionException: 500: java.io.EOFException

    Stack Overflow | 3 years ago | Sidaoui Mejdi
    java.lang.RuntimeException: An error occured while executing doInBackground()
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. java.io.EOFException

    No message provided

    at libcore.io.Streams.readAsciiLine()
  2. Android
    HttpURLConnectionImpl.getResponseCode
    1. libcore.io.Streams.readAsciiLine(Streams.java:203)
    2. libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:573)
    3. libcore.net.http.HttpEngine.readResponse(HttpEngine.java:821)
    4. libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283)
    5. libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:495)
    5 frames
  3. Spring
    RestTemplate.exchange
    1. org.springframework.http.client.SimpleClientHttpResponse.getRawStatusCode(SimpleClientHttpResponse.java:54)
    2. org.springframework.http.client.SimpleClientHttpResponse.getStatusCode(SimpleClientHttpResponse.java:80)
    3. org.springframework.web.client.DefaultResponseErrorHandler.hasError(DefaultResponseErrorHandler.java:46)
    4. org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:477)
    5. org.springframework.web.client.RestTemplate.execute(RestTemplate.java:439)
    6. org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:415)
    6 frames
  4. org.test.service
    RestApi_.sendGreeting
    1. org.test.service.rest.RestApi_.sendGreeting(RestApi_.java:91)
    1 frame
  5. org.test.activities
    TestActivity_$4.execute
    1. org.test.activities.TestActivity.send(TestActivity.java:89)
    2. org.test.activities.TestActivity_.access$101(TestActivity_.java:29)
    3. org.test.activities.TestActivity_$4.execute(TestActivity_.java:160)
    3 frames
  6. AndroidAnnotations API
    BackgroundExecutor$Task.run
    1. org.androidannotations.api.BackgroundExecutor$Task.run(BackgroundExecutor.java:302)
    1 frame
  7. Java RT
    Thread.run
    1. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
    2. java.util.concurrent.FutureTask.run(FutureTask.java:234)
    3. java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:153)
    4. java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
    5. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    6. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    7. java.lang.Thread.run(Thread.java:856)
    7 frames