Exception Thrown While Accessing Capabilities Using AdminRoleService.getAdminRolesForUser API (Doc ID 2227861.1)

Last updated on JANUARY 27, 2017

Applies to:

Identity Manager - Version 11.1.2.3.0 and later
Information in this document applies to any platform.

Symptoms

The following exception is thrown when attempting to access capabilities that are associated with individual admin role using adminRoleService.getAdminRolesForUser(userKey,null) API.


Exception [EclipseLink-7242] (Eclipse Persistence Services - 2.3.1.v20111018-r10243): org.eclipse.persistence.exceptions.ValidationException
Exception Description: An attempt was made to traverse a relationship using indirection that had a null Session. This often occurs when an entity with an uninstantiated LAZY relationship is serialized and that lazy relationship is traversed after serialization. To avoid this issue, instantiate the LAZY relationship prior to serialization.
at org.eclipse.persistence.exceptions.ValidationException.instantiatingValueholderWithNullSession(ValidationException.java:998)
at org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:96)
at org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:88)
at org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:88)
at org.eclipse.persistence.indirection.IndirectList.buildDelegate(IndirectList.java:244)
at org.eclipse.persistence.indirection.IndirectList.getDelegate(IndirectList.java:414)
at org.eclipse.persistence.indirection.IndirectList$1.<init>(IndirectList.java:542)
at org.eclipse.persistence.indirection.IndirectList.listIterator(IndirectList.java:541)
at org.eclipse.persistence.indirection.IndirectList.iterator(IndirectList.java:505)

Sample code that produces above exception.

AdminRoleService adminRoleSrvc = oimClient.getService(AdminRoleService.class);
List adminroles1 = adminRoleSrvc.getAdminRolesForUser(userKey,null);
for (AdminRole a :adminroles1) {
          String roleName = a.getRoleName();
          System.out.println("Admin Role Name: " + roleName );
List capabilities;
capabilities = a.getCapabilitiess();
for (Capability c: capabilities) {
          System.out.println("Action Name: "+ c.getActionName());
          System.out.println("Resource Name: " + c.getResourceName());

    }
}

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms