tRestClient : HTTP method DELETE doesn't support output

Four Stars

tRestClient : HTTP method DELETE doesn't support output

Hello,
I'm using Talend  5.6.2 and tRestClient component to call a rest webservice

tRestClient-DELETE.png
I have no problem with POST method but when using DELETE method i have the exception : HTTP method DELETE doesn't support output 
Removal is working when testing with Postman and using the same data entry

tRESTClient has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: .Problem with writing the request message, class : class org.dom4j.tree.DefaultDocument, ContentType : application/xml.
at org.apache.cxf.jaxrs.client.WebClient$BodyWriter.doWriteBody(WebClient.java:1197)
at org.apache.cxf.jaxrs.client.AbstractClient$AbstractBodyWriter.handleMessage(AbstractClient.java:1058)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:635)
at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1067)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:878)
at org.apache.cxf.jaxrs.client.WebClient$BodyWriter.doWriteBody(WebClient.java:1197)
at org.apache.cxf.jaxrs.client.AbstractClient$AbstractBodyWriter.handleMessage(AbstractClient.java:1058)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:635)
at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1067)
... 6 more
Caused by: javax.ws.rs.client.ClientException: .Problem with writing the request message, class : class org.dom4j.tree.DefaultDocument, ContentType : application/xml.
at org.apache.cxf.jaxrs.client.AbstractClient.reportMessageHandlerProblem(AbstractClient.java:756)
at org.apache.cxf.jaxrs.client.AbstractClient.writeBody(AbstractClient.java:450)
at org.apache.cxf.jaxrs.client.WebClient$BodyWriter.doWriteBody(WebClient.java:1192)
... 10 more
Caused by: java.net.ProtocolException: HTTP method DELETE doesn't support output
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:852)
at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:312)

.....
Caused by: javax.ws.rs.client.ClientException: .Problem with writing the request message, class : class org.dom4j.tree.DefaultDocument, ContentType : application/xml.
at org.apache.cxf.jaxrs.client.AbstractClient.reportMessageHandlerProblem(AbstractClient.java:756)
at org.apache.cxf.jaxrs.client.AbstractClient.writeBody(AbstractClient.java:450)
at org.apache.cxf.jaxrs.client.WebClient$BodyWriter.doWriteBody(WebClient.java:1192)
... 10 more
Caused by: java.net.ProtocolException: HTTP method DELETE doesn't support output
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.setupWrappedStream(URLConnectionHTTPConduit.java:174)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1289)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1245)
at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.onFirstWrite(URLConnectionHTTPConduit.java:201)
at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:47)
at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
at org.apache.cxf.io.CacheAndWriteOutputStream.write(CacheAndWriteOutputStream.java:80)
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 org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.setupWrappedStream(URLConnectionHTTPConduit.java:174)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1289)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1245)
at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.onFirstWrite(URLConnectionHTTPConduit.java:201)
at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:47)
at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
at org.apache.cxf.io.CacheAndWriteOutputStream.write(CacheAndWriteOutputStream.java:80)
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:92)
at org.apache.cxf.jaxrs.provider.dom4j.DOM4JProvider.writeTo(DOM4JProvider.java:42)
at org.apache.cxf.jaxrs.utils.JAXRSUtils.writeMessageBody(JAXRSUtils.java:1299)
at org.apache.cxf.jaxrs.client.AbstractClient.writeBody(AbstractClient.java:436)
... 11 more
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:92)
at org.apache.cxf.jaxrs.provider.dom4j.DOM4JProvider.writeTo(DOM4JProvider.java:42)
at org.apache.cxf.jaxrs.utils.JAXRSUtils.writeMessageBody(JAXRSUtils.java:1299)
at org.apache.cxf.jaxrs.client.AbstractClient.writeBody(AbstractClient.java:436)
... 11 more
----------------------------
ID: 1
Address: ..
Http-Method: DELETE
Content-Type: application/xml
Headers: {Accept=[application/xml], Content-Type=[application/xml]}

any explanation please?

 

 

 

 

Tags (1)
Moderator

Re: tRestClient : HTTP method DELETE doesn't support output

Hello,

It looks like a java runtime bug. Could you please have a look at this issue:https://bugs.java.com/view_bug.do?bug_id=7157360 and upgrade your Java environment to see if it works?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Four Stars

Re: tRestClient : HTTP method DELETE doesn't support output

Thinks Sabrina, 

When i modify to jdk 8 , i have an exception when executing the job:
"Exception in thread "main" java.lang.Error: Unresolved compilation problem"

Talend 5.6 doesn't support java 8