Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tRESTResponse: Exception Rest response already sent.

So I am working on reconciliation service for OpenRefine. OpenRefine send query with the following payload as Form.
Below an example of query sent by OpenRefine
queries={"q0":{"query":"Joe","limit":3},"q1":{"query":"John","limit":3},"q2":{"query":"Henry","limit":3},"q3":{"query":"Willliam","limit":3}}

My Talend job:
1. parse the payload into different record for q0, q1 ....
2. do some computing for each record and build individual JSON answer using a tMap (screenshot 02)
3. wrap all results in a single payload and pass it to tRESTResponse (screenshot 03)

As the first query got parsed the job failed with the following Exception:
Exception in component tRESTResponse_2
java.lang.RuntimeException: Rest response already sent.
at openrefinereconciliation.restservice2_0_1.RESTService2.tRESTRequest_1_LoopProcess(RESTService2.java:8091)
at openrefinereconciliation.restservice2_0_1.RESTService2$RestServiceProviderImpl4TalendJob.processRequest(RESTService2.java:598)
at openrefinereconciliation.restservice2_0_1.RESTService2$RestServiceProviderImpl4TalendJob.queries(RESTService2.java:700)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:192)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:100)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:93)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:355)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:319)
at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1088)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1024)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:370)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1021)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:722)

and I am clueless on what I am doing wrong? Is my document not formed properly at the tXMLMap level? Did I missed some configuration in the tRESTResponse (ie should I configure specific response header?)
Thanks in advance for your help.
0683p000009MDy1.png 0683p000009MDrp.png 0683p000009MDs9.png
Labels (6)
4 Replies
Anonymous
Not applicable
Author

Hi
The error message suggests that an attempt is made to repeatedly write a response into the back channel representing a current client request.
Unfortunately it is not possible to do it at the Studio level, there's an enhancement request to support streaming of the response data into a single tRESTRequest response, but it is not supported yet.
Can you open an enhancement request on your own and I will link to it from the internal JIRA issue ?

Cheers, Sergey
Anonymous
Not applicable
Author

Thanks Sergey,
I've created the following issue: https://jira.talendforge.org/browse/TESB-13475
I was not able to track back the issue to request to support streaming of the response data into a single tRESTRequest response. May you provide a link to it?
thanks
Anonymous
Not applicable
Author

Thanks, I've linked to it from TESB-12039
Cheers, Sergey
Anonymous
Not applicable
Author

Hi,
this may be helpful: setting the XMLMap's output option "All in one" to "true" shovels all rows to one document before passing the row out... this helped me in a similar problem
regards,
Patrick