3 Replies Latest reply on Jul 2, 2013 5:15 PM by delhi

    Error in oim Role creation using Role Manager Service API from Standalone Java client

    1007576


      Hi,

        Facing the following error when trying to create Role using Role Manager Service API from a standalone java client .

      Tried with the solution of changing ,

      Login into the Web Logic Admin Console --> Servers --> OIM Server --> Protocols --> Modify the Maximum Message from 100000000 to 1000000000, but still the problem persists.

       

      Exception in thread "main" org.omg.CORBA.BAD_PARAM:   vmcid: 0x0  minor code: 0  completed: No

      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

      at java.lang.reflect.Constructor.newInstance(Unknown Source)

      at java.lang.Class.newInstance0(Unknown Source)

      at java.lang.Class.newInstance(Unknown Source)

      at com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.getSystemException(Unknown Source)

      at com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_2.getSystemException(Unknown Source)

      at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.getSystemExceptionReply(Unknown Source)

      at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(Unknown Source)

      at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(Unknown Source)

      at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.invoke(Unknown Source)

      at org.omg.CORBA.portable.ObjectImpl._invoke(Unknown Source)

      at com.sun.org.omg.SendingContext._CodeBaseStub.meta(Unknown Source)

      at com.sun.corba.se.impl.encoding.CachedCodeBase.meta(Unknown Source)

      at com.sun.corba.se.impl.io.IIOPInputStream.getOrderedDescriptions(Unknown Source)

      at com.sun.corba.se.impl.io.IIOPInputStream.inputObjectUsingFVD(Unknown Source)

      at com.sun.corba.se.impl.io.IIOPInputStream.simpleReadObject(Unknown Source)

      at com.sun.corba.se.impl.io.ValueHandlerImpl.readValueInternal(Unknown Source)

      at com.sun.corba.se.impl.io.ValueHandlerImpl.readValue(Unknown Source)

      at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(Unknown Source)

      at com.sun.corba.se.impl.encoding.CDRInputStream.read_value(Unknown Source)

      at oracle.iam.identity.rolemgmt.api._RoleManager_ogut7n_RoleManagerRemoteRIntf_Stub.createx(Unknown Source)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

      at java.lang.reflect.Method.invoke(Unknown Source)

      at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:85)

      at $Proxy2.createx(Unknown Source)

      at oracle.iam.identity.rolemgmt.api.RoleManagerDelegate.create(Unknown Source)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

      at java.lang.reflect.Method.invoke(Unknown Source)

      at Thor.API.Base.SecurityInvocationHandler$1.run(SecurityInvocationHandler.java:68)

      at weblogic.security.subject.SubjectProxy.doAs(SubjectProxy.java:64)

      at weblogic.security.subject.SubjectManager.runAs(SubjectManager.java:262)

      at weblogic.security.Security.runAs(Security.java:48)

      at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(weblogicLoginSession.java:52)

      at Thor.API.Base.SecurityInvocationHandler.invoke(SecurityInvocationHandler.java:79)

      at $Proxy3.create(Unknown Source)

      at com.idm.role.CreateRole.createRole(CreateRole.java:113)

      at com.idm.role.CreateRole.main(CreateRole.java:167)

       

      Thanks In Advance

        • 1. Re: Error in oim Role creation using Role Manager Service API from Standalone Java client
          delhi

          can you show the code and which version r1 or r2?

          • 2. Re: Error in oim Role creation using Role Manager Service API from Standalone Java client
            1007576

            Hi , I have used OIM 11g  R2.

            Please find below the code we have used,

             

            package com.idm.role;

            import java.util.HashMap;
            import java.util.HashSet;
            import java.util.Hashtable;
            import java.util.Iterator;
            import java.util.Set;
            import java.util.logging.Logger;

            import javax.security.auth.login.LoginException;

            import oracle.iam.identity.exception.NoSuchRoleException;
            import oracle.iam.identity.exception.RoleAlreadyExistsException;
            import oracle.iam.identity.exception.RoleCreateException;
            import oracle.iam.identity.exception.RoleLookupException;
            import oracle.iam.identity.exception.RoleModifyException;
            import oracle.iam.identity.exception.SearchKeyNotUniqueException;
            import oracle.iam.identity.exception.ValidationFailedException;
            import oracle.iam.identity.rolemgmt.api.RoleManager;
            import oracle.iam.identity.rolemgmt.api.RoleManagerConstants;
            import oracle.iam.identity.rolemgmt.vo.Role;
            import oracle.iam.platform.OIMClient;
            import oracle.iam.platform.authz.exception.AccessDeniedException;

             

            public class CreateRole {
            private final static Logger LOGGER = Logger.getLogger(CreateRole.class .getName());

            OIMClient oimClient = null;

            public OIMClient connectToOIM() {
              LOGGER.info("In connectToOIM ");
             
              Hashtable env = new Hashtable();
              env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL,
                "weblogic.jndi.WLInitialContextFactory");
              env.put(OIMClient.JAVA_NAMING_PROVIDER_URL,
                "t3://V-hydidm1.itig.co.in:14000");
              System.setProperty("java.security.auth.login.config",
                "F:\\Projects\\IDM\\Team\\Env_setup\\OIM_Setup\\designconsole\\config\\authwl.conf");
              System.setProperty("java.security.policy",
                "F:\\Projects\\IDM\\Team\\Env_setup\\OIM_Setup\\designconsole\\config\\xl.policy");
              System.setProperty("OIM.AppServerType", "wls");
              System.setProperty("APPSERVER_TYPE", "wls");
              System.setProperty("weblogic.Name", "oim_server1");

              oimClient = new OIMClient(env);
              try {
               oimClient.login("xelsysadm", "Passw0rd".toCharArray());
              } catch (LoginException e) {
               e.printStackTrace();
              }
              System.out.println("Connected");
              return oimClient;
            }

            public void readRoleMetadata() {
             
              LOGGER.info("in readRoleMetadata ");
              RoleManager roleManagerService = oimClient
                .getService(RoleManager.class);
              try {

               Role roleVo = roleManagerService.getDetails(
                 RoleManagerConstants.ROLE_DISPLAY_NAME, "API Role1", null);
               Set attributeNameSet = roleVo.getAttributeNames();
               Iterator it = attributeNameSet.iterator();
               while (it.hasNext()) {
                System.out.println("Attribute Name :: " + it.next());
               }
               // roleVo.setAttribute("ADentitlements", "Security Admin access");
               String adEntitlements = "" + roleVo.getAttribute("ADentitlements");

               System.out.println("AD Entitlements :: " + adEntitlements);
               System.out.println("DB Entitlements :: " + ""
                 + roleVo.getAttribute("DBEntitlements"));
               System.out.println("Unix Entitlements :: " + ""
                 + roleVo.getAttribute("UnixWindows"));
               System.out.println("VPN :: " + "" + roleVo.getAttribute("VPN"));

              } catch (SearchKeyNotUniqueException e) {
               e.printStackTrace();
              } catch (NoSuchRoleException e) {
               e.printStackTrace();
              } catch (RoleLookupException e) {
               e.printStackTrace();
              } catch (AccessDeniedException e) {
               e.printStackTrace();
              }

            }

            public void createRole() {

             

              LOGGER.info(" in Create role ");
              RoleManager roleManagerService = oimClient
                .getService(RoleManager.class);

              HashMap<String, Object> roleCreationAttrMap = new HashMap<String, Object>();
              roleCreationAttrMap.put(RoleManagerConstants.ROLE_NAME, "API Role1");
              roleCreationAttrMap.put(RoleManagerConstants.ROLE_DESCRIPTION,
                "This Role is created using API Role1");
              roleCreationAttrMap.put(RoleManagerConstants.ROLE_DISPLAY_NAME,
                "API Role1");
              roleCreationAttrMap.put("ADentitlements", "API Role1 AD Entitlements");
              roleCreationAttrMap.put("DBEntitlements", "API Role1 DB Entitlements");
              roleCreationAttrMap.put("VPN", "No");
              roleCreationAttrMap.put("UnixWindows", "API Role1 Unix Entitlements");

              Role roleVo = new Role(roleCreationAttrMap);
              try {
               System.out.println(" Before Create role *********************************************");
               roleManagerService.create(roleVo);
               System.out.println("Role Created .. ");
              } catch (ValidationFailedException e) {
               e.printStackTrace();
              } catch (RoleAlreadyExistsException e) {
               e.printStackTrace();
              } catch (RoleCreateException e) {
               e.printStackTrace();
              } catch (AccessDeniedException e) {
               e.printStackTrace();
              }
            }

            public void modifyRole() {

             

              LOGGER.info(" in modifyRole ");
              RoleManager roleManagerService = oimClient
                .getService(RoleManager.class);
              Role roleVo;
              try {
               roleVo = roleManagerService.getDetails(
                 RoleManagerConstants.ROLE_DISPLAY_NAME, "API Role1", null);

               String roleKey = roleVo.getEntityId();

               HashMap<String, Object> roleCreationAttrMap = new HashMap<String, Object>();
               roleCreationAttrMap.put("ADentitlements",
                 "Updated API Role1 AD Entitlements");

               Set roleKeySet = new HashSet<String>();
               roleKeySet.add(roleKey);
               Role roleVoNew = new Role(roleCreationAttrMap);
               roleManagerService.modify(roleKeySet, roleVoNew);

               System.out.println("Role Modified ..");
              } catch (SearchKeyNotUniqueException e) {
               e.printStackTrace();
              } catch (NoSuchRoleException e) {
               e.printStackTrace();
              } catch (RoleLookupException e) {
               e.printStackTrace();
              } catch (AccessDeniedException e) {
               e.printStackTrace();
              } catch (ValidationFailedException e) {
               e.printStackTrace();
              } catch (RoleModifyException e) {
               e.printStackTrace();
              }

            }

            public static void main(String args[]) {
              CreateRole miscObj = new CreateRole();
              miscObj.connectToOIM();
              miscObj.createRole();
              //miscObj.readRoleMetadata();
            }

             

            }

             

             

            Thanks In Advance .