2017-07-19 29 views
0

私たちのサービスでは、次のEOFエラーが発生しています。 weblogic serverにwarとしてデプロイされたspringブートアプリケーションです。weblogicコンテナのSpring RestTemplateを使用したEOF例外

org.springframework.web.client.ResourceAccessException: I/O error on PUT request for "http://*****/update: Response had end of stream after 0 bytes; nested exception is java.io.EOFException: Response had end of stream after 0 bytes 
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:633) 
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:580) 
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:498) 
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) 
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720) 
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) 
at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:115) 
at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
at java.lang.Thread.run(Thread.java:745) 
Caused by: java.io.EOFException: Response had end of stream after 0 bytes 
at weblogic.net.http.MessageHeader.isHTTP(MessageHeader.java:312) 
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 org.springframework.http.client.SimpleClientHttpResponse.getRawStatusCode(SimpleClientHttpResponse.java:52) 
at org.springframework.http.client.AbstractClientHttpResponse.getStatusCode(AbstractClientHttpResponse.java:33) 
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:655) 
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:620) 
... 10 more 

このblogは、私が見ているものを正確に表しています。私はRestTemplateを使用していますが、これはデフォルトのHttpClientFactoryでweblogicではありません。何故私は何をしなければならないのですか?同じ問題に直面したとき、それは他のに役立ちますので、私は答えを投稿しています

おかげ

答えて

0

HttpClientFactoryをrestTemplateに明示的に設定することで、このエラーを取り除くことができました。私はデフォルトで、RestTemplateHttpClientと考えました。なぜ私はこれを設定する必要があるのか​​分かりません。しかし、これが解決に役立ちました。

@Bean 
public RestTemplate restTemplate(){ 
    HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(); 
    RestTemplate template = new RestTemplate(factory); 
    template.setErrorHandler(new RestResponseHandler()); 
    return template; 
    } 

私が持っていた前

@Bean 
    public RestTemplate restTemplate(){ 
    return new RestTemplate(); 
    } 
関連する問題