배포 한 CXF 웹 서비스의 메서드를 WS 클라이언트에서 호출하려고하면 연결 시간이 초과됩니다. 둘 다 커스텀 인터셉터를 사용하고 있으며 다중 호출로 인해 서비스가 오버로드됩니다.CXF java.net.ConnectException : 연결 시간이 초과되었습니다.
Caused by: java.net.ConnectException: ConnectException invoking http://xxx.xx.xx.xx:12005/myservice/repository?wsdl: Connection timed out
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1338)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1322)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:622)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
... 36 more
시간 초과를 사용하지 않도록 설정하거나 늘리려면 여러 가지 방법을 시도했지만 모두 실패했습니다.
첫째, 나는 다음과 같은 CXF 구성 파일을 만들려고 : 다음
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<http-conf:conduit name="*.http-conduit">
<http-conf:client CacheControl="no-cache"
ConnectionTimeout="0" ReceiveTimeout="0" AllowChunking="false" />
</http-conf:conduit>
</beans>
을, 나는 내가 할 수있는 로그에서 Java 시스템 등록 정보 -Dcxf.config.file=/home/test/resources/cxf.xml
를 사용하여로드 내 응용 프로그램을 강제로 참조 구성은 읽기 때문에 아마 적용하는 것이
정보 :로드 구성 파일/홈/시험/자원/cxf.xml.
아쉽게도 연결 시간이 초과되었습니다.
public static void setHTTPPolicy(Client client) {
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(0);
httpClientPolicy.setReceiveTimeout(0);
httpClientPolicy.setAsyncExecuteTimeout(0);
http.setClient(httpClientPolicy);
}
을하지만 다시 연결 시간 초과가 발생합니다 : I 시도
두 번째 솔루션은 다음 코드 조각을 사용하여 모든 클라이언트에 프로그램 적으로 정책을 설정으로 구성되어 있습니다.
내가 무엇인가 놓친가요? 구성 할 다른 시간 초과가 있습니까? 어떤 도움도 환영합니다.
연결 제한 시간은 일반적으로 다른 문제의 증상, 그리고 그 자체로 원인 : 다음은 CXF에서
<jaxws:endpoint/>
옵션을 사용하여 샘플 설정입니다. 몇 가지 서비스 호출에 대해 연결 시간 제한이 없다고 말하고 있습니까? – kolossus예, 일부 호출이 잘 작동합니다. 내 시나리오는 큰 첨부 파일을 전송하는 것으로 구성되므로 시간 초과를 설명합니다. 내가 가진 문제는 클라이언트와 서버 측의 타임 아웃 구성에 있습니다. – Laurent
아. 그럼 스레드 풀링을 권하고 싶습니다. 곧 내 대답을 찾으십시오. – kolossus