Support Article
When connecting to a restservice, a nullpointer is thrown
SA-18885
Summary
When connecting to a restservice, a nullpointer is thrown at pyInvokeRESTConnector, step 12, in the line:
httpResponse = client.execute(httpRequest, (com.pega.apache.http.protocol.BasicHttpContext)localContext);
Error Messages
com.pega.pegarules.pub.services.ConnectorException: Caught unhandled exception: java.lang.NullPointerException
at com.pegarules.generated.activity.ra_action_pyinvokerestconnector_eb7dafe6dac00116b03b951c8add1e9a.step12_circum0(ra_action_pyinvokerestconnector_eb7dafe6dac00116b03b951c8add1e9a.java:2913)
at com.pegarules.generated.activity.ra_action_pyinvokerestconnector_eb7dafe6dac00116b03b951c8add1e9a.perform(ra_action_pyinvokerestconnector_eb7dafe6dac00116b03b951c8add1e9a.java:260)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3500)
at com.pegarules.generated.activity.ra_action_invoke_6a91441c4f6e5048b63360383ae1b952.step7_circum0(ra_action_invoke_6a91441c4f6e5048b63360383ae1b952.java:1002)
at com.pegarules.generated.activity.ra_action_invoke_6a91441c4f6e5048b63360383ae1b952.perform(ra_action_invoke_6a91441c4f6e5048b63360383ae1b952.java:172)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3500)
.............
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1881)
Caused by:
java.lang.NullPointerException
at com.pega.apache.http.impl.auth.NTLMEngineImpl.stripDotSuffix(NTLMEngineImpl.java:175)
at com.pega.apache.http.impl.auth.NTLMEngineImpl.convertHost(NTLMEngineImpl.java:183)
at com.pega.apache.http.impl.auth.NTLMEngineImpl.access$4(NTLMEngineImpl.java:182)
at com.pega.apache.http.impl.auth.NTLMEngineImpl$Type1Message.<init>(NTLMEngineImpl.java:764)
at com.pega.apache.http.impl.auth.NTLMEngineImpl.getType1Message(NTLMEngineImpl.java:128)
at com.pega.apache.http.impl.auth.NTLMEngineImpl.generateType1Msg(NTLMEngineImpl.java:1298)
at com.pega.apache.http.impl.auth.NTLMScheme.authenticate(NTLMScheme.java:125)
at com.pega.apache.http.impl.auth.AuthSchemeBase.authenticate(AuthSchemeBase.java:124)
at com.pega.apache.http.client.protocol.RequestTargetAuthentication.process(RequestTargetAuthentication.java:105)
at com.pega.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:108)
at com.pega.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecutor.java:174)
at com.pega.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:462)
at com.pega.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:825)
at com.pega.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:759)
at com.pegarules.generated.activity.ra_action_pyinvokerestconnector_eb7dafe6dac00116b03b951c8add1e9a.step12_circum0(ra_action_pyinvokerestconnector_eb7dafe6dac00116b03b951c8add1e9a.java:2467)
... 115 more
Steps to Reproduce
Run a Rest connect with NTLM authentication.
Root Cause
The root error found in your Pega logs is:
Caused by:
java.lang.NullPointerException
at com.pega.apache.http.impl.auth.NTLMEngineImpl.stripDotSuffix(NTLMEngineImpl.java:175)
at com.pega.apache.http.impl.auth.NTLMEngineImpl.convertHost(NTLMEngineImpl.java:183)
at com.pega.apache.http.impl.auth.NTLMEngineImpl.access$4(NTLMEngineImpl.java:182)
These affected classes are in fact coming from a third partly library called HTTP client.
User is experiencing a defect from this third partly library, which generate this error when hostname and domain are not populated.
Resolution
Fill Hostname and domain in the authentication rule used by the Rest connector.
Published January 26, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.