Support Article
Activity in Service-REST fails with NullPointerException
SA-30158
Summary
A custom activity in a Service-REST fails with a NullPointerException. Issue is similar one detailed in PDN article:
https://pdn.pega.com/support-articles/nullpointerexception-while-reading-header-rest-service.
User is requesting port to Pega 7.1.8.
Error Messages
Caused by: java.lang.NullPointerException
at com.pegarules.generated.activity.ra_action_authenticateofflineuser_daaaa6ae1929d7e2e886952183f55220.step1_circum0(
ra_action_authenticateofflineuser_daaaa6ae1929d7e2e886952183f55220.java:290)
at com.pegarules.generated.activity.ra_action_authenticateofflineuser_daaaa6ae1929d7e2e886952183f55220.perform(
ra_action_authenticateofflineuser_daaaa6ae1929d7e2e886952183f55220.java:69)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3500)
at com.pega.pegarules.session.internal.mgmt.authentication.AuthenticationUtil.runActivity(AuthenticationUtil.java:208)
Steps to Reproduce
- Create a Service Package and Service-REST rule.
- Create an Authentication Service with an authentication activity.
- Set the Authentication Service in the Service Package.
- In the authentication activity, have the code to read the HTTP servlet request as below:
- @java("((javax.servlet.http.HttpServletRequest)tools.getRequestor().getRequestorPage().getObject(\"pxHTTPServletRequest\")).getHeader(\"SMUSER\")")
- Test the connector.
Root Cause
Servlet request object is not available in custom authentication activity.
Resolution
Apply HFix-30358.
Published November 18, 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.