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

  1. Create a Service Package and Service-REST rule.
  2. Create an Authentication Service with an authentication activity.
  3. Set the Authentication Service in the Service Package.
  4. In the authentication activity, have the code to read the HTTP servlet request as below:
    1. ​@java("((javax.servlet.http.HttpServletRequest)tools.getRequestor().getRequestorPage().getObject(\"pxHTTPServletRequest\")).getHeader(\"SMUSER\")")
  5. Test the connector.


Root Cause



Servlet request object is not available in custom authentication activity.

Resolution



Apply HFix-30358.

 

Published November 8, 2016 - Updated November 18, 2016

Have a question? Get answers now.

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