BookmarkSubscribeRSS Feed
RTDM_User
Fluorite | Level 6

HI,

 

HELP needed with java.lang.NullPointerException ERROR,

 

I’m trying to run the code below (i have imported all the necessary packages) - 

 

def slurper = new groovy.json.JsonSlurper()

def result = slurper.parseText('{"name":["itay","omer","shlomi","rotem"],"age":30}')

def client = new RESTClient( 'http://localhost:3000' )

writeToFile("JSON REQ1")

writeToFile(result)

def resp = client.post( path : '/testrtdm',

ContentType: JSON,

body: result,

 

and getting error without any explanation –

 

com.sas.analytics.ph.RTDMException: Failure running user groovy activity

at com.sas.analytics.crm.rtdm.activities.GroovyClassActivity.execute(GroovyClassActivity.java:279)

at com.sas.rtdm.implementation.EventExecutor.execute(EventExecutor.java:243)

at com.sas.rtdm.implementation.TestExecutor.execute(TestExecutor.java:209)

at com.sas.rtdm.implementation.engine.ActivityNode._execute(ActivityNode.java:58)

at com.sas.rtdm.implementation.engine.ActivityNode._execute(ActivityNode.java:18)

at com.sas.rtdm.implementation.engine.SchedulableNode$1.call(SchedulableNode.java:89)

at com.sas.rtdm.implementation.engine.SchedulableNode$1.call(SchedulableNode.java:82)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:748)

Caused by: java.lang.NullPointerException

at groovyx.net.http.HTTPBuilder$RequestConfigDelegate.setBody(HTTPBuilder.java:1200)

at groovyx.net.http.HTTPBuilder$RequestConfigDelegate.setPropertiesFromMap(HTTPBuilder.java:1111)

at groovyx.net.http.HTTPBuilder$RequestConfigDelegate.<init>(HTTPBuilder.java:946)

at groovyx.net.http.RESTClient.post(RESTClient.java:140)

at groovyx.net.http.RESTClient$post$0.call(Unknown Source)

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 MyActivity.run(script1548768272512393757402.groovy:54)

at com.sas.analytics.crm.rtdm.activities.GroovyClassActivity.execute(GroovyClassActivity.java:267)

... 10 more

 

2 REPLIES 2
JamesAnderson
SAS Employee

HI,

 

This problem appears to be caused by incorrect use of the groovy library RESTClient. I dont have a great deal of exposure to that, perhaps a post on a groovy coding forum will yield better results.

 

Cheers

James

RTDM_User
Fluorite | Level 6

Hi james and thank you for answering,

I don’t think that the use of RESTClient causing the error because before the current POST method I’ve tried and succeed with get method (called the api and got the json response).

I assume that I don’t have the correct syntax for activating the POST method.

Do you have an example of post rest via groovy?

Tnx, Itay.

 

 

G2 Grid Leader Spring 2025.png

 

 

 

 

Want to review SAS Customer Intelligence 360? Gartner and G2 are offering a gift card or charitable donation for each accepted review. Use this link for G2 to opt out of receiving anything of value for your review.

 

Gartner.jpg

 

SAS Customer Intelligence 360

Get started with CI 360

Review CI 360 Release Notes

Open a Technical Support case

Suggest software enhancements

Assess your marketing efforts with a free tool

 

Training Resources

SAS Customer Intelligence Learning Subscription (login required)

Access free tutorials

Refer to documentation

Latest hot fixes

Compatibility notice re: SAS 9.4M8 (TS1M8) or later

How to improve email deliverability

SAS' Peter Ansbacher shows you how to use the dashboard in SAS Customer Intelligence 360 for better results.

Find more tutorials on the SAS Users YouTube channel.

G2 Grid Leader Spring 2025.png

 

 

 

 

Want to review SAS Customer Intelligence 360? Gartner and G2 are offering a gift card or charitable donation for each accepted review. Use this link for G2 to opt out of receiving anything of value for your review.

 

Gartner.jpg

 

SAS Customer Intelligence 360

Get started with CI 360

Review CI 360 Release Notes

Open a Technical Support case

Suggest software enhancements

Assess your marketing efforts with a free tool

 

Training Resources

SAS Customer Intelligence Learning Subscription (login required)

Access free tutorials

Refer to documentation

Latest hot fixes

Compatibility notice re: SAS 9.4M8 (TS1M8) or later

Discussion stats
  • 2 replies
  • 1659 views
  • 0 likes
  • 2 in conversation