Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello there,
I got this issue over and over again in my jobs, when tRESTClient throws a Java Exception:
javax.ws.rs.ProcessingException:java.lang.IllegalArgumentException: Illegal status value : -1
Full stack below:
[WARN ]: org.apache.cxf.transport.http.HTTPConduit - HTTP Response code appears to be corrupted [WARN ]: org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for {http://SRV-ERP-DEV.atech.local:8284/rest/AtechTESInteligente/v1}tRESTClient has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: Could not send Message. at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:67) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:710) at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1051) at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:897) at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:866) at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:431) at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:611) at protheus_api.pedidovenda_0_1.PedidoVenda.tJavaFlex_3Process(PedidoVenda.java:19990) at protheus_api.pedidovenda_0_1.PedidoVenda.tRESTRequest_1_LoopProcess(PedidoVenda.java:29370) at protheus_api.pedidovenda_0_1.PedidoVenda$RestServiceProviderImpl4TalendJob.processRequest(PedidoVenda.java:1281) at protheus_api.pedidovenda_0_1.PedidoVenda$RestServiceProviderImpl4TalendJob.create(PedidoVenda.java:1376) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193) at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103) at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267) at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:247) at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:79) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:205) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:220) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.Server.handle(Server.java:505) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:698) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:804) at java.lang.Thread.run(Thread.java:748) Caused by: java.io.IOException: IOException invoking http://SRV-ERP-DEV.atech.local:8284/rest/AtechTESInteligente/v1?nEntSai=2&cTpOper=03&cClieFor=000329&cLoja=001&cTipoCF=C&cProduto=008888: Invalid Http response at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1402) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1386) at org.apache.cxf.io.AbstractWrappedOutputStream.close(AbstractWrappedOutputStream.java:77) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:673) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63) ... 43 more Caused by: java.io.IOException: Invalid Http response at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1950) at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1945) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1944) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1514) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498) at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getInputStream(URLConnectionHTTPConduit.java:354) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1686) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1572) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1373) ... 47 more Caused by: java.io.IOException: Invalid Http response at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1612) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream$2.run(URLConnectionHTTPConduit.java:377) at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream$2.run(URLConnectionHTTPConduit.java:373) at java.security.AccessController.doPrivileged(Native Method) at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getResponseCode(URLConnectionHTTPConduit.java:373) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doProcessResponseCode(HTTPConduit.java:1599) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1627) ... 49 more
For my requirements it is common that the job needs to make one request to an external REST API for each row in a flow (or in an iteration).
In that scenario, when a tRESTClient component performs several requests, it seems to break sometimes. Not always. It is an intermitent behavior.
Example: a job needs to create a sales order with several itens. For each item, it needs to query an API to get some data for the item. Then, at last, it creates the sales order with enriched data.
I of course wondered if the external API could be generating the intermitent failures, but I have really exhausted test requests to them via Postman, with lots of concurrent requests, and they yield 100% success. I even took a look at the network traffic through Wireshark and it shows that the API is behaving well (TCP speaking). Besides, I have had this problem with several different external API's already.
My guess is, tRESTClient needs to perform a graceful process finish after the communication ended. Sometimes, the job/JVM processing time to get to the next row/iteration is faster than the time tRESTClient needs to finish its ending/dealloc/free/reset internal objects/variables. (Should'n it be another instance of tRESTClient_1, anyway?)
Just to remark: I have had this problem with tRESTClient in a flow and also in an iteration.