Support Article

REST Integration Wizard throwing NullPointerException

SA-23570

Summary



Attempt to consume the REST service by passing a sample query with nested JSON elements results in a NullPointerException (NPE) when Pega tries to generate the rules. The preview screen throws the same error in the logs and presents a blank screen showing no rules to generate. For example, the array element ("prop2.id" : ["186","197"]) in this sample JSON causes this issue (nested inside another array element).

{
    "size" : 0,
    "query": {
        "filtered": {
            "filter": {
                "bool": {
                    "must": [
                    {
                        "term": { "prop1" : "value1" }
                    },
                    {
                        "terms": { "prop2.id" : ["186","197"] }
                    },




Error Messages

This is from logs when attempt to generate rules. 

2016-05-10 17:07:07,655 [http-bio-8080-exec-7] [TABTHREAD3] [                    ] [   app-name:01.01.01] (  internal.util.PRServiceUtils) ERROR  Admin@GCS-JSONTest - Rule Generator thrown exception: 
java.lang.NullPointerException
    at com.pega.pegarules.integration.config.internal.mapping.RuleGeneratorREST.addRequestDTSteps(RuleGeneratorREST.java:777)
    at com.pega.pegarules.integration.config.internal.mapping.RuleGeneratorREST.addRequestDTSteps(RuleGeneratorREST.java:822)
    at com.pega.pegarules.integration.config.internal.mapping.RuleGeneratorREST.addRequestDTSteps(RuleGeneratorREST.java:804)
    at com.pega.pegarules.integration.config.internal.mapping.RuleGeneratorREST.addRequestDTSteps(RuleGeneratorREST.java:804)
    at com.pega.pegarules.integration.config.internal.mapping.RuleGeneratorREST.addRequestDTSteps(RuleGeneratorREST.java:804)
    at com.pega.pegarules.integration.config.internal.mapping.RuleGeneratorREST.addRequestDTSteps(RuleGeneratorREST.java:804)
    at com.pega.pegarules.integration.config.internal.mapping.RuleGeneratorREST.addRequestDTSteps(RuleGeneratorREST.java:804)
    at com.pega.pegarules.integration.config.internal.mapping.RuleGeneratorREST.addRequestDTSteps(RuleGeneratorREST.java:804)
    at com.pega.pegarules.integration.config.internal.mapping.RuleGeneratorREST.addRequestDataTransformInfo(RuleGeneratorREST.java:528)
    at com.pega.pegarules.integration.config.internal.mapping.RuleGeneratorREST.addDataPageInfoForREST(RuleGeneratorREST.java:411)
    at com.pega.pegarules.integration.config.internal.mapping.RuleGeneratorREST.processConnectorMetadata(RuleGeneratorREST.java:193)

 



Steps to Reproduce



1.) Create a new Rest integration (used any URL). 
2.) Bypass Define Parameters. 
3.) For methods, deselect GET and select POST. 
3.) Open Configure for POST. 
4.) Add Sample > Choose File (sample.json) > Upload File. 
5.) Click OK. 
6.) Click Next. Choose Preview screen shows blank screen (NPE shown in log). 
7.) Choose Create screen shows generation-error.jpg attached ... (NPE shown in log). 


Root Cause



A defect in Pegasystems’ code or rules.

Resolution



Apply HFix-27628.

 

Published May 19, 2016 - Updated August 22, 2016

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.