Four Stars

tRESTClient Connection reset

Hello,

 

I have a first Talend Job build with TOS DI 6.4.1 which I got handed over from a colleague. He called a REST-Service with own Java-Code using javax.net.ssl.HttpsURLConnection. I replaced all occurences with tRESTClient. This workes fine for from time to time we get an Error. Between 1 to 7 for around 500 calls we make per job execution. Seams to be very randomly. It does not belog to a certain record or time. We run the Job in the Studio.

 

[ERROR]: org.apache.cxf.jaxrs.utils.JAXRSUtils - Problem with writing the data, class org.dom4j.tree.DefaultDocument, ContentType: application/xml
[WARN ]: org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for {https://erp.quinscape.de/xml}tRESTClient has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Problem with writing the data, class org.dom4j.tree.DefaultDocument, ContentType: application/xml
	at org.apache.cxf.jaxrs.client.WebClient$BodyWriter.doWriteBody(WebClient.java:1183)
	at org.apache.cxf.jaxrs.client.AbstractClient$AbstractBodyWriter.handleMessage(AbstractClient.java:1174)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
	at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:677)
	at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1041)
	at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:895)
	at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:863)
	at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:426)
	at org.apache.cxf.jaxrs.client.WebClient.post(WebClient.java:456)
	at vertec.vertec_test_0_1.Vertec_Test.tJava_3Process(Vertec_Test.java:10193)
	at vertec.vertec_test_0_1.Vertec_Test.tFixedFlowInput_1Process(Vertec_Test.java:2754)
	at vertec.vertec_test_0_1.Vertec_Test.runJobInTOS(Vertec_Test.java:13889)
	at vertec.vertec_test_0_1.Vertec_Test.main(Vertec_Test.java:13672)
Caused by: javax.ws.rs.ProcessingException: Problem with writing the data, class org.dom4j.tree.DefaultDocument, ContentType: application/xml
	at org.apache.cxf.jaxrs.client.AbstractClient.reportMessageHandlerProblem(AbstractClient.java:810)
	at org.apache.cxf.jaxrs.client.AbstractClient.writeBody(AbstractClient.java:494)
	at org.apache.cxf.jaxrs.client.WebClient$BodyWriter.doWriteBody(WebClient.java:1178)
	... 12 more
Caused by: java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(Unknown Source)
	at java.net.SocketInputStream.read(Unknown Source)
	at sun.security.ssl.InputRecord.readFully(Unknown Source)
	at sun.security.ssl.InputRecord.read(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
	at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.setupWrappedStream(URLConnectionHTTPConduit.java:273)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1328)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1288)
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.onFirstWrite(URLConnectionHTTPConduit.java:305)
	at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:47)
	at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
	at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
	at sun.nio.cs.StreamEncoder.implFlushBuffer(Unknown Source)
	at sun.nio.cs.StreamEncoder.implFlush(Unknown Source)
	at sun.nio.cs.StreamEncoder.flush(Unknown Source)
	at java.io.OutputStreamWriter.flush(Unknown Source)
	at java.io.BufferedWriter.flush(Unknown Source)
	at org.dom4j.io.XMLWriter.flush(XMLWriter.java:272)
	at org.dom4j.io.XMLWriter.write(XMLWriter.java:350)
	at org.apache.cxf.jaxrs.provider.dom4j.DOM4JProvider.writeTo(DOM4JProvider.java:107)
	at org.apache.cxf.jaxrs.provider.dom4j.DOM4JProvider.writeTo(DOM4JProvider.java:47)
	at org.apache.cxf.jaxrs.utils.JAXRSUtils.writeMessageBody(JAXRSUtils.java:1386)
	at org.apache.cxf.jaxrs.client.AbstractClient.writeBody(AbstractClient.java:480)
	... 13 more
Exception in component tRESTClient_5 (Vertec_Test)
javax.ws.rs.ProcessingException: Problem with writing the data, class org.dom4j.tree.DefaultDocument, ContentType: application/xml
	at org.apache.cxf.jaxrs.client.AbstractClient.reportMessageHandlerProblem(AbstractClient.java:810)
	at org.apache.cxf.jaxrs.client.AbstractClient.writeBody(AbstractClient.java:494)
	at org.apache.cxf.jaxrs.client.WebClient$BodyWriter.doWriteBody(WebClient.java:1178)
	at org.apache.cxf.jaxrs.client.AbstractClient$AbstractBodyWriter.handleMessage(AbstractClient.java:1174)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
	at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:677)
	at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1041)
	at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:895)
	at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:863)
	at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:426)
	at org.apache.cxf.jaxrs.client.WebClient.post(WebClient.java:456)
	at vertec.vertec_test_0_1.Vertec_Test.tJava_3Process(Vertec_Test.java:10193)
	at vertec.vertec_test_0_1.Vertec_Test.tFixedFlowInput_1Process(Vertec_Test.java:2754)
	at vertec.vertec_test_0_1.Vertec_Test.runJobInTOS(Vertec_Test.java:13889)
	at vertec.vertec_test_0_1.Vertec_Test.main(Vertec_Test.java:13672)
Caused by: java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(Unknown Source)
	at java.net.SocketInputStream.read(Unknown Source)
	at sun.security.ssl.InputRecord.readFully(Unknown Source)
	at sun.security.ssl.InputRecord.read(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
	at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.setupWrappedStream(URLConnectionHTTPConduit.java:273)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1328)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1288)
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.onFirstWrite(URLConnectionHTTPConduit.java:305)
	at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:47)
	at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
	at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
	at sun.nio.cs.StreamEncoder.implFlushBuffer(Unknown Source)
	at sun.nio.cs.StreamEncoder.implFlush(Unknown Source)
	at sun.nio.cs.StreamEncoder.flush(Unknown Source)
	at java.io.OutputStreamWriter.flush(Unknown Source)
	at java.io.BufferedWriter.flush(Unknown Source)
	at org.dom4j.io.XMLWriter.flush(XMLWriter.java:272)
	at org.dom4j.io.XMLWriter.write(XMLWriter.java:350)
	at org.apache.cxf.jaxrs.provider.dom4j.DOM4JProvider.writeTo(DOM4JProvider.java:107)
	at org.apache.cxf.jaxrs.provider.dom4j.DOM4JProvider.writeTo(DOM4JProvider.java:47)
	at org.apache.cxf.jaxrs.utils.JAXRSUtils.writeMessageBody(JAXRSUtils.java:1386)
	at org.apache.cxf.jaxrs.client.AbstractClient.writeBody(AbstractClient.java:480)
	... 13 more

In WireShark it seams as if the client resets the connection. The strange thing is: It works with the self writen code. So it may be a problem in cxf.

6 REPLIES
Fifteen Stars

Re: tRESTClient Connection reset

This looks like it is a problem with data. The error....

 

Problem with writing the data, class org.dom4j.tree.DefaultDocument, ContentType: application/xml

...suggests that maybe it is to do with some badly formatted XML.

 

Unfortunately all we can do is guess with the information you have provided so far. 

 

 

Rilhia Solutions
Four Stars

Re: tRESTClient Connection reset

Thank you for your answer.

 

No, it is not the data. I've done a few dozen executions now with the same data. The error occurs sometimes and randomly. Exactly the same data sometimes passes and sometimes not. It passes always with the handcoded solution. I believe it's how CXF uses the network. But I do not know how to get around that.

Fifteen Stars

Re: tRESTClient Connection reset

What HTTP method are you using? It *could* be related to this issue....

https://community.talend.com/t5/Design-and-Development/tRestClient-HTTP-method-DELETE-doesn-t-suppor...

 

If you could give us a couple of screenshots of your job and your tRestClient component config (Basic Settings and Advanced) we might be able to see a cause if it isn't related to the bug I pointed to above. Alternatively, have you tried using the tRest component instead?

Rilhia Solutions
Four Stars

Re: tRESTClient Connection reset

Thank you. We have to use POST for all Operations. I add some Screenshots. (I do not really know whats helpfull here.)

 

2018-01-16_08_58_30.png2018-01-16_08_58_48.png

Four Stars

Re: tRESTClient Connection reset

Hello, have you solved your problem?
I'm having the same kinf of issue, The job that I've created sometimes works correctly and other times generates the same error as you.

From the IT office a colleague said to me that this could be a problem related to the number of active connection to the ORACLE Application Express, where the RESTfull calls are located.

Could you let me know if you solved this problem?
Regards.

Four Stars

Re: tRESTClient Connection reset

No, unfortunally I do not have a solution for the problem yet. Meanwhile we use the handcoded solution. :-(

 

Most probably the problem is the following: By default CFX uses chuncking for the payload. This may cause such error messages. If read that it's very likely when the other endpoint is implemented in .NET, which is true in our case. You can  deactivate the chuncking in the component. But there is bug in cfx, that when using SSL, the chuncking can not be deactivated programmatically. Theres the possibility to deactivate it despite this but, when using a Spring configuration. But I haven't figured out how to do this within a simple Talend Open Studio Job.