Skip to Content.
Sympa Menu

grouper-users - [grouper-users] RE: Null Pointer Exception while calling permissions web service

Subject: Grouper Users - Open Discussion List

List archive

[grouper-users] RE: Null Pointer Exception while calling permissions web service


Chronological Thread 
  • From: Chris Hyzer <>
  • To: "Sachdeva, Vivek" <>, "" <>
  • Subject: [grouper-users] RE: Null Pointer Exception while calling permissions web service
  • Date: Fri, 31 Jan 2014 07:48:13 +0000
  • Accept-language: en-US

This is fixed

 

https://bugs.internet2.edu/jira/browse/GRP-954

 

You can patch it by editing GrouperServiceLogic line 6096: 

FROM: 
      Set<String> attributeDefIds = WsAttributeDefLookup.convertToAttributeDefIds(session, wsAttributeDefLookups, errorMessage, AttributeDefType.perm, usePIT, pointInTimeFrom, pointInTimeTo); 
       
      //get the attributeDefNames to retrieve 
      Set<String> attributeDefNameIds = WsAttributeDefNameLookup.convertToAttributeDefNameIds(session, wsAttributeDefNameLookups, errorMessage, AttributeDefType.perm, usePIT, pointInTimeFrom, pointInTimeTo); 


TO: 

      Set<String> attributeDefIds = GrouperUtil.nonNull(WsAttributeDefLookup.convertToAttributeDefIds(session, wsAttributeDefLookups, errorMessage, AttributeDefType.perm, usePIT, pointInTimeFrom, pointInTimeTo)); 
       
      //get the attributeDefNames to retrieve 
      Set<String> attributeDefNameIds = GrouperUtil.nonNull(WsAttributeDefNameLookup.convertToAttributeDefNameIds(session, wsAttributeDefNameLookups, errorMessage, AttributeDefType.perm, usePIT, pointInTimeFrom, pointInTimeTo)); 

 

Thanks,

Chris

 

 

From: Sachdeva, Vivek [mailto:]
Sent: Friday, January 24, 2014 12:42 PM
To: Chris Hyzer;
Subject: Re: Null Pointer Exception while calling permissions web service

 

I am running WsSampleGetPermissionAssignmentsRestLite. When I inspect response variable its value is:

 

<WsGetPermissionAssignmentsResults><wsPermissionAssigns><WsPermissionAssign><limits><edu.internet2.middleware.grouper.ws.coresoap.WsPermissionLimit><wsAttributeAssignValues><WsAttributeAssignValue><id>092c2e13035d4ca7b823b9bc3afb5546</id><valueSystem>ucla</valueSystem></WsAttributeAssignValue></wsAttributeAssignValues><attributeAssignId>94ea96570ec9485993eba3271c22d44c</attributeAssignId><attributeDefNameId>891011b760674b82a3422e9431e15f83</attributeDefNameId><attributeDefNameName>etc:attribute:permissionLimits:limitLabelsContain</attributeDefNameName></edu.internet2.middleware.grouper.ws.coresoap.WsPermissionLimit></limits><action>create</action><permissionType>role</permissionType><attributeDefNameId>f2f800a1873141619d82e185f63a376c</attributeDefNameId><attributeDefNameName>ucla:ucla_perms:Dossier Accuracy Verification</attributeDefNameName><attributeDefId>6a97396d54524acda399bb5e2033fc23</attributeDefId><attributeDefName>ucla:ucla_perms:hierarchy_perm_def</attributeDefName><enabled>T</enabled><attributeAssignId>bc3f2b65cd974328b4a51cd3bf542e6c</attributeAssignId><roleId>de38c198296c46ab869e6b630709c0ab</roleId><roleName>ucla:ucla_roles:VCAP</roleName><subjectId>102</subjectId><sourceId>sourceId</sourceId><membershipId>d72374aae0224bc3b9646a2ac966f251:f736b82744624766a180e36ca6cd9b58</membershipId><allowedOverall>T</allowedOverall><disallowed>F</disallowed></WsPermissionAssign></wsPermissionAssigns><resultMetadata><resultCode>EXCEPTION</resultCode><resultMessage>clientVersion: 2.1.5, wsAttributeDefLookups: null, wsAttributeDefNameLookups: null, roleLookups: null, actions: null, includePermissionAssignDetail: false, includeAttributeDefNames: false, includeAttributeAssignments: false, includeSubjectDetail: false, actAsSubject: WsSubjectLookup[subjectId=GrouperSystem], subjectAttributeNames: null

, paramNames: 

, params: null

, wsSubjectLookups: Array size: 1: [0]: WsSubjectLookup[subjectIdentifier=102]

, enabled: null

 pointInTimeFrom: null, pointInTimeTo: null

 immediateOnly: false, permissionType: null, permissionProcessor: null

 limitEnvVars: null

 includeLimits: true, java.lang.NullPointerException

at edu.internet2.middleware.grouper.ws.GrouperServiceLogic.getPermissionAssignments(GrouperServiceLogic.java:6175)

at edu.internet2.middleware.grouper.ws.GrouperServiceLogic.getPermissionAssignmentsLite(GrouperServiceLogic.java:6343)

at edu.internet2.middleware.grouper.ws.coresoap.GrouperService.getPermissionAssignmentsLite(GrouperService.java:3599)

at edu.internet2.middleware.grouper.ws.rest.GrouperServiceRest.getPermissionAssignmentsLite(GrouperServiceRest.java:1676)

at edu.internet2.middleware.grouper.ws.rest.method.GrouperWsRestGet$8.service(GrouperWsRestGet.java:431)

at edu.internet2.middleware.grouper.ws.rest.method.GrouperRestHttpMethod$1.service(GrouperRestHttpMethod.java:57)

at edu.internet2.middleware.grouper.ws.rest.GrouperRestServlet.service(GrouperRestServlet.java:199)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at edu.internet2.middleware.grouper.ws.GrouperServiceJ2ee.doFilter(GrouperServiceJ2ee.java:659)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:611)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:724)

</resultMessage><success>F</success></resultMetadata><responseMetadata><resultWarnings></resultWarnings><millis>84466</millis><serverVersion>2.1.5</serverVersion></responseMetadata></WsGetPermissionAssignmentsResults>

 

 

Thanks,

Vivek

From: Chris Hyzer <>
Date: Fri, 24 Jan 2014 15:05:29 +0000
To: vivek sachdeva <>, "" <>
Subject: RE: Null Pointer Exception while calling permissions web service

 

Can you send me the full stack trace when you get the error?

 

From: Sachdeva, Vivek []
Sent: Thursday, January 23, 2014 7:47 PM
To: Chris Hyzer;
Subject: Re: Null Pointer Exception while calling permissions web service

 

Hi,

 

I am seeing the same error again. It happens when the limits are assigned to the actions and in the request I set includeLimits to true. I also made sure that the subject exists in the source. The error does not occur when I explicitly set the WsAttributeDefNameName and WsAttributeDefName in the request. So, Is it a requirement to set the Permission definition name and resource name In the request when setting includeLimits to true ?? 

 

WorkswsRestGetPermissionAssignmentsLiteRequest.setActAsSubjectId("GrouperSystem");

       wsRestGetPermissionAssignmentsLiteRequest.setWsAttributeDefName("ucla:ucla_perms:hierarchy_perm_def");

      wsRestGetPermissionAssignmentsLiteRequest.setWsSubjectIdentifier("vivek");

      wsRestGetPermissionAssignmentsLiteRequest.setIncludeLimits("T");

      wsRestGetPermissionAssignmentsLiteRequest.setWsAttributeDefNameName("ucla:ucla_perms:Dossier Accuracy Verification");

 

 

Does not work:

wsRestGetPermissionAssignmentsLiteRequest.setActAsSubjectId("GrouperSystem");

      wsRestGetPermissionAssignmentsLiteRequest.setWsSubjectIdentifier("vivek");

      wsRestGetPermissionAssignmentsLiteRequest.setIncludeLimits("T");

 

 

The output when it works is:

 

<?xml version="1.0" encoding="UTF-8"?>
<WsGetPermissionAssignmentsResults>   <wsAttributeDefs>
      <WsAttributeDef>
         <extension>limitsDef</extension>
         <name>etc:attribute:permissionLimits:limitsDef</name>
         <uuid>bee3dcbe3dd2410a8420926dc63127a5</uuid>
         <attributeDefType>limit</attributeDefType>
         <multiAssignable>T</multiAssignable>
         <multiValued>F</multiValued>
         <valueType>string</valueType>
      </WsAttributeDef>
      <WsAttributeDef>
         <extension>hierarchy_perm_def</extension>
         <name>ucla:ucla_perms:hierarchy_perm_def</name>
         <uuid>6a97396d54524acda399bb5e2033fc23</uuid>
         <attributeDefType>perm</attributeDefType>
         <multiAssignable>F</multiAssignable>
         <multiValued>F</multiValued>
         <valueType>marker</valueType>
      </WsAttributeDef>
   </wsAttributeDefs>
   <wsPermissionAssigns>
      <WsPermissionAssign>
         <limits>
            <edu.internet2.middleware.grouper.ws.coresoap.WsPermissionLimit>
               <wsAttributeAssignValues>
                  <WsAttributeAssignValue>
                     <id>092c2e13035d4ca7b823b9bc3afb5546</id>
                     <valueSystem>ucla</valueSystem>
                  </WsAttributeAssignValue>
               </wsAttributeAssignValues>
               <attributeAssignId>94ea96570ec9485993eba3271c22d44c</attributeAssignId>
               <attributeDefNameId>891011b760674b82a3422e9431e15f83</attributeDefNameId>
               <attributeDefNameName>etc:attribute:permissionLimits:limitLabelsContain</attributeDefNameName>
            </edu.internet2.middleware.grouper.ws.coresoap.WsPermissionLimit>
         </limits>
         <action>create</action>
         <permissionType>role</permissionType>
         <attributeDefNameId>f2f800a1873141619d82e185f63a376c</attributeDefNameId>
         <attributeDefNameName>ucla:ucla_perms:Dossier Accuracy Verification</attributeDefNameName>
         <attributeDefId>6a97396d54524acda399bb5e2033fc23</attributeDefId>
         <attributeDefName>ucla:ucla_perms:hierarchy_perm_def</attributeDefName>
         <enabled>T</enabled>
         <attributeAssignId>bc3f2b65cd974328b4a51cd3bf542e6c</attributeAssignId>
         <roleId>de38c198296c46ab869e6b630709c0ab</roleId>
         <roleName>ucla:ucla_roles:VCAP</roleName>
         <subjectId>102</subjectId>
         <sourceId>sourceId</sourceId>
         <membershipId>d72374aae0224bc3b9646a2ac966f251:f736b82744624766a180e36ca6cd9b58</membershipId>
         <allowedOverall>T</allowedOverall>
         <disallowed>F</disallowed>
      </WsPermissionAssign>
   </wsPermissionAssigns>
   <resultMetadata>
      <resultCode>SUCCESS</resultCode>
      <resultMessage>, Found 1 results.</resultMessage>
      <success>T</success>
   </resultMetadata>
   <responseMetadata>
      <resultWarnings />
      <millis>4021</millis>
      <serverVersion>2.1.5</serverVersion>
   </responseMetadata>
   <wsGroups>
      <WsGroup>
         <extension>VCAP</extension>
         <typeOfGroup>role</typeOfGroup>
         <displayExtension>VCAP</displayExtension>
         <description>VCAP</description>
         <displayName>University of California Los Angeles:UCLA Roles:VCAP</displayName>
         <name>ucla:ucla_roles:VCAP</name>
         <uuid>de38c198296c46ab869e6b630709c0ab</uuid>
      </WsGroup>
   </wsGroups>
   <wsSubjects>
      <WsSubject>
         <resultCode>SUCCESS</resultCode>
         <success>T</success>
         <id>102</id>
         <name>vivek</name>
         <sourceId>sourceId</sourceId>
      </WsSubject>
   </wsSubjects>
</WsGetPermissionAssignmentsResults>

 

Thanks,

Vivek

 

 

 

From: vivek sachdeva <>
Date: Wed, 1 Jan 2014 19:57:10 -0800
To: Chris Hyzer <>, "" <>
Subject: Re: Null Pointer Exception while calling permissions web service

 

Thanks Chris!

 

I ran it in debug mode and noticed that one of the subjects ion the request did not exist in the Grouper. Once I fixed that it started working.

 

Vivek

 

 

From: Chris Hyzer <>

Date: Thu, 2 Jan 2014 02:18:56 +0000
To: vivek sachdeva <>, "" <>
Subject: RE: Null Pointer Exception while calling permissions web service

 

This worked for me.

 

Did you run the sample data program to setup the registry (note, I think this might destroy your database, do this on a sample schema)

 

(it’s a private method, so you need to edit the main in SampleCapture and run it from there:

 

  /**

   * @param args

   */

  publicstaticvoid main(String[] args) {

 

    SampleCapture.setupData();

 

  }

 

  

 

Request

<WsRestGetPermissionAssignmentsRequest>

  <includeLimits>T</includeLimits>

  <wsAttributeDefLookups>

    <WsAttributeDefLookup>

      <uuid></uuid>

      <name>aStem:permissionDef</name>

    </WsAttributeDefLookup>

  </wsAttributeDefLookups>

</WsRestGetPermissionAssignmentsRequest>

 

Response

<WsGetPermissionAssignmentsResults>

  <wsAttributeDefs>

    <WsAttributeDef>

      <extension>permissionDef</extension>

      <name>aStem:permissionDef</name>

      <uuid>6c2dc30e23954d98940c2201a0153bf9</uuid>

      <attributeDefType>perm</attributeDefType>

      <multiAssignable>F</multiAssignable>

      <multiValued>F</multiValued>

     <valueType>marker</valueType>

    </WsAttributeDef>

  </wsAttributeDefs>

  <wsPermissionAssigns>

    <WsPermissionAssign>

      <action>read</action>

      <permissionType>role</permissionType>

      <attributeDefNameId>4b5fd97452f14080878562f4392a5faf

      </attributeDefNameId>

      <attributeDefNameName>aStem:permissionDefName

      </attributeDefNameName>

      <attributeDefId>6c2dc30e23954d98940c2201a0153bf9</attributeDefId>

      <attributeDefName>aStem:permissionDef</attributeDefName>

      <enabled>T</enabled>

      <attributeAssignId>de6b8c5ba12a4924a072df92d48df6c5

      </attributeAssignId>

      <roleId>99f73c24949d4e2f8ef69eaff40c85b2</roleId>

      <roleName>aStem:role</roleName>

      <subjectId>test.subject.0</subjectId>

      <sourceId>jdbc</sourceId>

      <membershipId>14d61db81d174154a6b6270753468870:81e4e2029a5c4513be9bce515bb22635

      </membershipId>

      <allowedOverall>T</allowedOverall>

      <disallowed>F</disallowed>

    </WsPermissionAssign>

    <WsPermissionAssign>

      <action>read</action>

      <permissionType>role</permissionType>

      <attributeDefNameId>4b5fd97452f14080878562f4392a5faf

      </attributeDefNameId>

      <attributeDefNameName>aStem:permissionDefName

      </attributeDefNameName>

      <attributeDefId>6c2dc30e23954d98940c2201a0153bf9</attributeDefId>

      <attributeDefName>aStem:permissionDef</attributeDefName>

      <enabled>T</enabled>

      <attributeAssignId>de6b8c5ba12a4924a072df92d48df6c5

      </attributeAssignId>

      <roleId>99f73c24949d4e2f8ef69eaff40c85b2</roleId>

      <roleName>aStem:role</roleName>

      <subjectId>test.subject.4</subjectId>

      <sourceId>jdbc</sourceId>

      <membershipId>bb65c5012fd84afaafa8c036514f27de:81e4e2029a5c4513be9bce515bb22635

      </membershipId>

      <allowedOverall>T</allowedOverall>

      <disallowed>F</disallowed>

    </WsPermissionAssign>

    <WsPermissionAssign>

      <action>write</action>

      <permissionType>role_subject</permissionType>

      <attributeDefNameId>b1c8ddbc905142378fe1acf45ceb2639

      </attributeDefNameId>

      <attributeDefNameName>aStem:permissionDefName2

      </attributeDefNameName>

      <attributeDefId>6c2dc30e23954d98940c2201a0153bf9</attributeDefId>

      <attributeDefName>aStem:permissionDef</attributeDefName>

      <enabled>T</enabled>

      <attributeAssignId>693e1a3d237b463f80bf5166e86e0848

      </attributeAssignId>

      <roleId>6684e92d31f1488c96723801cdd66c6f</roleId>

      <roleName>aStem:role2</roleName>

      <subjectId>test.subject.1</subjectId>

      <sourceId>jdbc</sourceId>

      <membershipId>d56994b19980411c920af6403756f218:8f910ded856e4b08aa87e8e0c16a67f4

      </membershipId>

      <allowedOverall>T</allowedOverall>

      <disallowed>F</disallowed>

    </WsPermissionAssign>

  </wsPermissionAssigns>

  <resultMetadata>

    <resultCode>SUCCESS</resultCode>

    <resultMessage>, Found 3 results.  </resultMessage>

    <success>T</success>

  </resultMetadata>

  <responseMetadata>

    <resultWarnings></resultWarnings>

    <millis>265</millis>

    <serverVersion>2.1.5</serverVersion>

  </responseMetadata>

  <wsGroups>

    <WsGroup>

      <extension>role</extension>

      <typeOfGroup>role</typeOfGroup>

      <displayExtension>role</displayExtension>

      <displayName>a stem:role</displayName>

      <name>aStem:role</name>

      <uuid>99f73c24949d4e2f8ef69eaff40c85b2</uuid>

    </WsGroup>

    <WsGroup>

      <extension>role2</extension>

      <typeOfGroup>role</typeOfGroup>

      <displayExtension>role2</displayExtension>

      <displayName>a stem:role2</displayName>

      <name>aStem:role2</name>

      <uuid>6684e92d31f1488c96723801cdd66c6f</uuid>

    </WsGroup>

  </wsGroups>

  <wsSubjects/>

</WsGetPermissionAssignmentsResults>

 

 

From: [] On Behalf Of Sachdeva, Vivek
Sent: Wednesday, January 01, 2014 5:34 PM
To:
Subject: [grouper-users] Null Pointer Exception while calling permissions web service

 

Hi,

 

I am running WsSampleGetPermissionAssignmentRest class to get the permissions assigned to a set of users. It runs successfully and give me result back when I do not include the limits in the request. But when I include the limits by having getPermissionAssignments.setIncludeLimits("T") it throws NPE at line number 6175 in the GrouperServiceLogic class. attributeDefNameIds is null and that is why NPE is thrown.  

 

For my use cases, some actions will have limits and some will not have so the clients will always need to include the limits. So my question is what is the best way to fix this issue ?  

 

Thanks,

Vivek




Archive powered by MHonArc 2.6.16.

Top of Page