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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] tRestRequest - parameters are not passed

Hello,
I have a Talend Job that begins with a tRestRequest component. I am having problems with the parameters because they cannot be set, meaning 0 rows are sent to it whenever I try to run it (image1). The job has multiple contexts (image2) and when I tried testing it on a default-context job with only the beginning context (image3), it was able to pass the parameters (image4). Is there something I am missing? I am testing the Rest with Postman and Google Chrome if that helps.
Please see screenshots below.
image1 - original job with 0 parameters row passed when tested
0683p000009MCUL.png
image2 - original job contexts
0683p000009MCV2.png
image3 - test job with 1 parameter row passed when tested
0683p000009MC4h.png
image4 - test job contexts
0683p000009MCSx.png
Best Regards,
Labels (3)
12 Replies
Anonymous
Not applicable
Author

UPDATE: I have tried deactivating all components and activating them one at a time, I found out that once I activa the tOracelSP component, the job is not able to pass a row from the REST request. Is this because of its connection to the database? Screenshot below:
0683p000009MCGm.png
Anonymous
Not applicable
Author

Hi Junmilsso,
You need to give us more information I am afraid. Is there an error stack in the output? Can you tell us how you are calling the service? Can you show us how the tRestRequest is configured?
One thing I have immediately spotted is that you are using a prejob component to start your connection. This is a service and as such will be "always on". Leaving the connection on from the beginning like this could cause you problems because it will only be used when you first switch the service on. The service could be running for months and the connection will not be renewed during that time. A better way is to have the connection instantiated for every call, an even better way is to use connection pooling with the "specify a data source alias" option in the connection component. That requires configuration inside Apache Karaf however.
You will also likely experience problems if the service is not closed with a tRestResponse component.
But before you look into that, can you give us the info I mentioned at the top?
 
Anonymous
Not applicable
Author

Hello rhall_2.0,
Thanks for your feedback, here are some more information regarding my problem:
Yes there is an error stacks, it mentions a NullPointerException since the parameters werent passed, thus showing 0 rows in the connection when I run it, causing no values to be usable by the tOracleSP component. Please see error stack below:
Starting job MUP_CreateSIDB003_job at 13:58 26/11/2015.
connecting to socket on port 3555
connected
: org.apache.cxf.endpoint.ServerImpl - Setting the server's publish address to be http://127.0.0.1:8090/REST/inv/sidb003_mupro
: org.eclipse.jetty.server.Server - jetty-8.1.14.v20131031
: org.eclipse.jetty.server.AbstractConnector - Started SelectChannelConnector@127.0.0.1:8090
Exception in component tOracleSP_1
java.lang.NullPointerException
at avemor_demo.mup_createsidb003_job_0_1.MUP_CreateSIDB003_job.tRESTRequest_1_LoopProcess(MUP_CreateSIDB003_job.java:1589)
at avemor_demo.mup_createsidb003_job_0_1.MUP_CreateSIDB003_job$RestServiceProviderImpl4TalendJob.processRequest(MUP_CreateSIDB003_job.java:582)
at avemor_demo.mup_createsidb003_job_0_1.MUP_CreateSIDB003_job$RestServiceProviderImpl4TalendJob.mupro(MUP_CreateSIDB003_job.java:688)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:188)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:104)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)
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:65)
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:494)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)
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(Unknown Source)
Job MUP_CreateSIDB003_job ended at 13:58 26/11/2015.


I have tested calling the service through Google Chrome and Postman, with this syntax:
    
          127.0.0.1:8090/REST/inv/sidb003_mupro?messageid=3000153933&uuid=666034
My tRESTRequest has been configured as follows:
           0683p000009MCCO.png
What could be the reason why the parameters were not passed? When I deactivated the tOracleSP and the succeeding components, the parameter was passed and I could do anything with it in the tJavaRow component (assign to a variable, print out, etc.).
Anonymous
Not applicable
Author

OK, you need to configure your "URI Pattern" to something like this.....
"/{messageid}/{uuid}"


....and you need to call the service like this.....
"http://127.0.0.1:8090/REST/inv/sidb003_mupro/3000153933/666034"

The URI Pattern needs to show how and where your parameters will sit in the URI. They parameter names you use in your  flow schema must be surrounded by curly brackets in the URI Pattern. 
Anonymous
Not applicable
Author

Thanks for the suggestion,
I have already set it but it shows the same error. Also, my previous settings were able to pass the parameters whenever I deactivate the tOracleSP component, was that the reason?
The problem is not how I passed the parameters. The problem is that whenever the tOracleSP component after the tJavaRow is activated, 0 rows are passed to the job from the REST call. If I deactivate it, the row and parameters get passed.
Anonymous
Not applicable
Author

I'm curious, have you actually seen evidence that the parameters have been passed into the service? Can you print them out to the execution output using a tLogRow? 
Also, can you post your tOracleSP settings? 
Anonymous
Not applicable
Author

Yes there is a 1 row in x seconds if I deactivate the tOracleSP, and I can print it using the "input_row.variable":
0683p000009MCV7.png
If I activate the tOracleSP, 0 rows in x seconds get passed:
0683p000009MCVC.png
Lastly, here are my tOracleSP settings:
0683p000009MCVH.png
Anonymous
Not applicable
Author

I've just had a thought, how are you passing the data on in the tJavaFlex component? This could be as simple as the data simply not being passed to the tOracleSP component. 
Anonymous
Not applicable
Author

Here's my code:
row3.messageid = mupro.messageid;
row3.uuid = mupro.uuid;
System.out.println("messageid = " + row3.messageid);
System.out.println("uuid = " + row3.uuid);