NullPointerException while accessing Puma - Websphere

This is a discussion on NullPointerException while accessing Puma - Websphere ; I am trying to look up some attributes about a certain user from LDAP, which means I am going to use PUMA. I continuously receive a NPE inside of the puma class: com.ibm.wps.services.puma.DefaultURManager.findUse rByAttribute(DefaultURManager.java:965) I don't think it is a ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: NullPointerException while accessing Puma

  1. NullPointerException while accessing Puma

    I am trying to look up some attributes about a certain user from LDAP, which means I am going to use PUMA.

    I continuously receive a NPE inside of the puma class: com.ibm.wps.services.puma.DefaultURManager.findUse rByAttribute(DefaultURManager.java:965)

    I don't think it is a JNDI issue b/c otherwise it would fail sooner in the code but maybe it is.

    Any thoughts or comments would be appreciated?

    Thanks,
    Sean


    *********************************************
    ArrayList userGroups = new ArrayList();

    PortletServiceHome psh;

    try {
    // get the puma user object
    javax.naming.Context ctx = new javax.naming.InitialContext();
    psh = (PortletServiceHome) ctx.lookup("portletservice/com.ibm.portal.um.portletservice.PumaHome");

    if (psh != null) {
    PumaHome service = (PumaHome) psh.getPortletService(PumaHome.class);
    PumaProfile pp = service.getProfile(request);

    PumaLocator pl = service.getLocator(request);

    List userList = pl.findUsersByAttribute(request.getParameter("searchBy"), request.getParameter("searchString")+"*");
    outputList(userList, "userList");
    List groupList = pl.findGroupsByAttribute("cn", request.getParameter("cn"));
    outputList(groupList, "groupList");

    User user = (User) pp.getCurrentUser();

    if(user == null){
    // logger.entry(Logger.TRACE_MEDIUM, "Cust__Login: " + "PumaProfile.getCurrentUser = null");
    logger.debug("PumaProfile.getCurrentUser = null");

    return null;
    }

    Enumeration attributeNamesEnum = user.getAttributeNames();
    while (attributeNamesEnum.hasMoreElements()) {
    String attributeName = (String) attributeNamesEnum
    nextElement();
    System.out.println(attributeName + " = "
    + user.get(attributeName));
    }

    if (user != null) {
    // get the groups for this user if not already
    List puma_groups = user.getNestedGroups();
    Iterator iter = puma_groups.iterator();
    while (iter.hasNext()) {
    Group group = (Group) iter.next();
    userGroups.add(group.getName());
    }
    }
    }else{
    logger.debug("psh had no value returned");

    }

    } catch (Exception e) {
    logger.debug("An Exception occurred within getUserGroups");
    throw new PortletException("e);
    }

    String userDomain = null;

    //TODO scc: cycle through user's attributes to figure out which group they belong to

    return userDomain;
    ******************************************


    Here is the exception I receive
    *****************************
    Caused by: java.lang.NullPointerException
    at com.ibm.wps.services.puma.DefaultURManager.findUse rByAttribute(DefaultURManager.java:965)
    at com.ibm.wps.services.puma.PumaServiceImpl.findUser ByAttribute(PumaServiceImpl.java:678)
    at com.ibm.wps.services.puma.Puma.findUserByAttribute (Puma.java:157)
    at com.ibm.wps.services.puma.PumaServiceWrapper.findU sersByAttribute(PumaServiceWrapper.java:1376)
    at com.mclane.portlets.service.LdapService.getUserGro ups(LdapService.java:62)
    *****************************

  2. Re: NullPointerException while accessing Puma

    Are you on 6.0 or 6.1? What is the 4-digit version number? Does the attribute contain a value for users (and groups) in the ldap itself? Does the bind id used by portal have permission in the ldap to return the attribute and its value?

    There should be more detail in another error message in the log about the specific attribute that cannot be retrieved.

  3. Re: NullPointerException while accessing Puma

    Hi - having the exact same issue. In my case, sometimes the groups are returned, sometimes they are not. Were you able to analyze the PUMA class to determine the issue?

+ Reply to Thread