search cancel

RA WS REST agent jobs throw Cannot invoke method getAt() on null object

book

Article ID: 201877

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine

Issue/Introduction

Getting  the below error while executing REST API calls using Automic REST Agents

An error occured - processing the request response
Cannot invoke method getAt() on null object

The RA REST Job is failing with the following error message in the log.

+++++++++++++++++++++++++++++++++++++ Start of Runtime Exception ++++++++++++++++++++++++++++++++++++
java.lang.NullPointerException: Cannot invoke method getAt() on null object
at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:47)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:34)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
at REST.processResponseItem(WebServiceRest.groovy:2304)
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.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:193)
at REST.handleResponse(WebServiceRest.groovy:2265)
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.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:193)
at REST.runJob(WebServiceRest.groovy:3064)
at com.uc4.extensibility.types.CITAgent.dispatchJob(CITAgent.java:258)
at com.uc4.ex.cit.CITJob.execute(CITJob.java:195)
at com.uc4.ex.Job.run(Job.java:461)
at com.uc4.ex.ThreadPool$RunnableDecorator.run(ThreadPool.java:53)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
++++++++++++++++++++++++++++++++++++++ End of Runtime Exception ++++++++++++++++++++++++++++++++++++++

 

Steps to reproduce:

Repro steps:

Use a GET on a http endpoint which delivers Content, but without the Content-Type in a rest job

Run a simple GET rest job against the endpoint -> it will fail when it should succeed

Cause

A Response is received with HTTP 200 OK, there is text content, but the Content-Type is missing.

The Agent can not parse the answer, and gives the following error:

020-10-09 10:07:09             pool-1-thread-4: REST: Get response content
2020-10-09 10:07:09            
2020-10-09 10:07:09            
2020-10-09 10:07:09             pool-1-thread-4: REST: An error occured - processing the request response
Cannot invoke method getAt() on null object
2020-10-09 10:07:09             An error occured - processing the request response
2020-10-09 10:07:09             Cannot invoke method getAt() on null object
2020-10-09 10:07:09             pool-1-thread-4: REST: Clean up client
 

+ a Nullpointer Exception:

+++++++++++++++++++++++++++++++++++++ Start of Runtime Exception ++++++++++++++++++++++++++++++++++++
java.lang.NullPointerException: Cannot invoke method getAt() on null object
                at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91)

Environment

Release : 12.3

Component : RA WEB SERVICE REST

Resolution

This was fixed with RA WebService REST agent 4.5.4


As a short-term workaround, please try to use cURL instead of the request sheet.

https://docs.automic.com/documentation/webhelp/english/AA/12.3/RA_WEB_SERVICE_REST/latest/Agent%20Guide/help_en.htm#RA/WS/LC/Creating_REST_Jobs.htm?Highlight=cURL