7 Replies Latest reply: Nov 20, 2012 3:51 AM by Raghu Honawad-Oracle RSS

    Error while connecting to OIM via Jdeveloper

    Raghu Honawad-Oracle
      Hi,

      I am getting the below error while executing simple search code. I am executing this code from Jdeveloper 11.1.2.2 and trying to connect to OIM 11gR1 BP04. SOPs shows, I am able to connecto to OIM, however while trying to search users below errors are thrown. I am not sure if it is code issue or firwall/proxy server issue. Any pointers would help.

      Error
      -------------------------------------------------------
      Creating client....
      Logging in
      log4j:WARN No appenders could be found for logger (org.springframework.jndi.JndiTemplate).
      log4j:WARN Please initialize the log4j system properly.
      java.lang.reflect.InvocationTargetException
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at oracle.iam.platform.OIMClient.loginSessionCreated(OIMClient.java:209)
           at oracle.iam.platform.OIMClient.login(OIMClient.java:136)
           at oracle.iam.platform.OIMClient.login(OIMClient.java:129)
           at com.oracle.idm.utilities.OIMUserSearch.init(OIMUserSearch.java:43)
           at com.oracle.idm.utilities.OIMUserSearch.main(OIMUserSearch.java:53)
      Caused by: java.lang.NoSuchMethodError: oracle.iam.platform.auth.util.ClientContextSetter.setClientIPAddress(Ljava/lang/String;)V
           at oracle.iam.platformservice.api.ClientLoginSessionServiceDelegate.loginSessionCreated(Unknown Source)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at Thor.API.Base.SecurityInvocationHandler$1.run(SecurityInvocationHandler.java:68)
           at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
           at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
           at weblogic.security.Security.runAs(Security.java:41)
           at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(weblogicLoginSession.java:52)
           at Thor.API.Base.SecurityInvocationHandler.invoke(SecurityInvocationHandler.java:79)
           at $Proxy1.loginSessionCreated(Unknown Source)
           ... 9 more
      Log in successful
      Getting user list...
      Service Obtained.
      Perfoming search*
      Exception in thread "main" java.lang.NoSuchMethodError: oracle.iam.platform.auth.util.ClientContextSetter.setClientIPAddress(Ljava/lang/String;)V
           at oracle.iam.identity.usermgmt.api.UserManagerDelegate.search(Unknown Source)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at Thor.API.Base.SecurityInvocationHandler$1.run(SecurityInvocationHandler.java:68)
           at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
           at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
           at weblogic.security.Security.runAs(Security.java:41)
           at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(weblogicLoginSession.java:52)
           at Thor.API.Base.SecurityInvocationHandler.invoke(SecurityInvocationHandler.java:79)
           at $Proxy3.search(Unknown Source)
           at com.oracle.idm.utilities.OIMUserSearch.getUserLogin(OIMUserSearch.java:99)
           at com.oracle.idm.utilities.OIMUserSearch.main(OIMUserSearch.java:56)
      Process exited with exit code 1.
      -------------------------------------------------------

      code
      -------------------------------------------------------
      System.out.println("Creating client....");
      String ctxFactory = "weblogic.jndi.WLInitialContextFactory";
      String serverURL = "t3://10.87.148.171:14000";
      String username = "xelsysadm";
      String password = "*****";
      Hashtable env = new Hashtable();
      env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL,ctxFactory);
      env.put(OIMClient.JAVA_NAMING_PROVIDER_URL, serverURL);
      oimClient = new OIMClient(env);
      System.out.println("Logging in");
      oimClient.login(username, password.toCharArray());
      System.out.println("Log in successful");

      System.out.println("Getting user list...");
      List<String> userLogins = new ArrayList<String>();
      UserManager usrService = oimClient.getService(UserManager.class);
      System.out.println("Service Obtained.");
      Set<String> retAttrs = new HashSet<String>();
      retAttrs.add(UserManagerConstants.AttributeName.USER_LOGIN.getId());
      SearchCriteria criteria = new SearchCriteria("First Name", FIRST_NAME2SEARCH, SearchCriteria.Operator.EQUAL);
      List<User> users = null;
      try {
      System.out.println("Perfoming search");
      users = usrService.search(criteria, retAttrs, null); // Getting error at this point.
      System.out.println("Search completed.");
      } catch (UserSearchException e)
        • 1. Re: Error while connecting to OIM via Jdeveloper
          Nishith Nayan
          jar is missing .first include all required jars in the path library.

          common-logging.jar
          eclipselink.jar
          oimclient.jar
          wlfullclient.jar
          spring .jar

          goto <OIM_HOME>/server/client/oimclient.zip and extract it you will get all above jars except wlfullclient.jar.

          get wlfullclient.jar from designconsole/ext folder if you have configured. else generate wlfullclient.jar and include it




          finally use below code you are not setting the java.security.auth.login.config which is mandatory


          final String OIM_URL = "t3://10.87.148.171:14000";
          final String AUTH_CONF ="C:\\test\\config\\authwl.conf";
          final String OIM_USERNAME = "xelsysadm";
          final String OIM_PASSWORD = "******";
          final String NULL = "(null)";
          OIMClient _oimClient = null;

          Hashtable<String, String> env = new Hashtable<String, String>();
          env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL, "weblogic.jndi.WLInitialContextFactory");
          env.put(OIMClient.JAVA_NAMING_PROVIDER_URL, OIM_URL);

          _oimClient = new OIMClient(env);

          System.setProperty("java.security.auth.login.config", AUTH_CONF);
          System.setProperty("OIM.AppServerType", "wls");
          System.setProperty("APPSERVER_TYPE", "wls");
          try{
          oimClient.login(OIMUSERNAME, OIM_PASSWORD.toCharArray());
          System.out.println("login success");
          return _oimClient;
          }catch(Exception e){
          System.out.println("login error "+e.getMessage());
          return _oimClient;
          }


          // verify authwl.conf path at your local machine. if not there copy from<OIM_HOME>designconsole/config folder
          • 2. Re: Error while connecting to OIM via Jdeveloper
            Dhananjay Neeraj2
            Exception in thread "main" java.lang.NoSuchMethodError: oracle.iam.platform.auth.util.ClientContextSetter.setClientIPAddress(Ljava/lang/String;)V

            It is not ClassNotFoundException...

            It is saying that the class was found but method was missing...


            So, I guess that the correct jar from correct location is missing... You are using jars from wrong locations probably...

            Please revisit the below URL:-

            http://docs.oracle.com/cd/E27559_01/dev.1112/e27150/apis.htm#BCFCDJGJ

            Validate whether OIM_ORACLE_HOME/server/client/oimclient.zip is used to obtain jars and no where else...

            Also, check whether the Env Variables are correctly set:-



            java.security.auth.login.config=OIM_CLIENT_HOME/conf/authwl.conf

            APPSERVER_TYPE=wls
            • 3. Re: Error while connecting to OIM via Jdeveloper
              Raghu Honawad-Oracle
              Hi Nishith,

              All the mentioned jars were already present in classpath.

              Also, changed the code (pasting below). Interestingly, Login seems to happen but, at the time of user search, it is throwing error. Is the error suggesting something wrong with proxy setting?

              New code:
              ---------------
              List logins = null;

              System.out.println("Creating client....");
              String ctxFactory = "weblogic.jndi.WLInitialContextFactory";
              String serverURL = "t3://10.87.148.171:14000";
              String username = "xelsysadm";
              String password = "*******";

              Hashtable env = new Hashtable();
              env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL,ctxFactory);
              env.put(OIMClient.JAVA_NAMING_PROVIDER_URL, serverURL);

              System.setProperty("java.security.auth.login.config", "D:\\Oracle\\Middleware\\OIM_DC\\designconsole\\config\\authwl.conf");
              System.setProperty("OIM.AppServerType","wls");
              System.setProperty("APPSERVER_TYPE", "wls");

              oimClient = new OIMClient(env);
              System.out.println("Logging in");
              oimClient.login(username, password.toCharArray());
              System.out.println("Log in successful");

              System.out.println("Getting user list...");
              List<String> userLogins = new ArrayList<String>();
              UserManager usrService = oimClient.getService(UserManager.class);
              System.out.println("Service Obtained.");
              Set<String> retAttrs = new HashSet<String>();
              retAttrs.add(UserManagerConstants.AttributeName.USER_LOGIN.getId());
              SearchCriteria criteria = new SearchCriteria("First Name", FIRST_NAME2SEARCH, SearchCriteria.Operator.EQUAL);
              List<User> users = null;
              System.out.println("Perfoming search");
              users = usrService.search(criteria, retAttrs, null);
              System.out.println("Search completed.");
              for (int i = 0; i < users.size(); i++) {
              userLogins.add(users.get(i).getLogin());
              System.out.println(users.get(i).getLogin());
              }
              System.out.println("Completed...");
              ---------------------------------

              Error
              ------------------------------
              Creating client....
              Logging in
              log4j:WARN No appenders could be found for logger (org.springframework.jndi.JndiTemplate).
              log4j:WARN Please initialize the log4j system properly.
              java.lang.reflect.InvocationTargetException
                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:597)
                   at oracle.iam.platform.OIMClient.loginSessionCreated(OIMClient.java:209)
                   at oracle.iam.platform.OIMClient.login(OIMClient.java:136)
                   at oracle.iam.platform.OIMClient.login(OIMClient.java:129)
                   at com.oracle.idm.utilities.OIMUserSearch.main(OIMUserSearch.java:59)
              Caused by: java.lang.NoSuchMethodError: oracle.iam.platform.auth.util.ClientContextSetter.setClientIPAddress(Ljava/lang/String;)V
                   at oracle.iam.platformservice.api.ClientLoginSessionServiceDelegate.loginSessionCreated(Unknown Source)
                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:597)
                   at Thor.API.Base.SecurityInvocationHandler$1.run(SecurityInvocationHandler.java:68)
                   at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
                   at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
                   at weblogic.security.Security.runAs(Security.java:41)
                   at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(weblogicLoginSession.java:52)
              Log in successful
              Getting user list...
                   at Thor.API.Base.SecurityInvocationHandler.invoke(SecurityInvocationHandler.java:79)
                   at $Proxy1.loginSessionCreated(Unknown Source)
                   ... 8 more
              Service Obtained.
              Perfoming search
              java.lang.reflect.InvocationTargetException
                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:597)
                   at oracle.iam.platform.OIMClient.loginSessionDestroyed(OIMClient.java:225)
                   at oracle.iam.platform.OIMClient.logout(OIMClient.java:154)
                   at com.oracle.idm.utilities.OIMUserSearch.main(OIMUserSearch.java:84)
              Caused by: java.lang.NoSuchMethodError: oracle.iam.platform.auth.util.ClientContextSetter.setClientIPAddress(Ljava/lang/String;)V
                   at oracle.iam.platformservice.api.ClientLoginSessionServiceDelegate.loginSessionDestroyed(Unknown Source)
                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:597)
                   at Thor.API.Base.SecurityInvocationHandler$1.run(SecurityInvocationHandler.java:68)
                   at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
                   at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
                   at weblogic.security.Security.runAs(Security.java:41)
                   at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(weblogicLoginSession.java:52)
                   at Thor.API.Base.SecurityInvocationHandler.invoke(SecurityInvocationHandler.java:79)
                   at $Proxy1.loginSessionDestroyed(Unknown Source)
                   ... 7 more
              Exception in thread "main" java.lang.NoSuchMethodError: oracle.iam.platform.auth.util.ClientContextSetter.setClientIPAddress(Ljava/lang/String;)V
                   at oracle.iam.identity.usermgmt.api.UserManagerDelegate.search(Unknown Source)
                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:597)
                   at Thor.API.Base.SecurityInvocationHandler$1.run(SecurityInvocationHandler.java:68)
                   at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
                   at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
                   at weblogic.security.Security.runAs(Security.java:41)
                   at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(weblogicLoginSession.java:52)
                   at Thor.API.Base.SecurityInvocationHandler.invoke(SecurityInvocationHandler.java:79)
                   at $Proxy3.search(Unknown Source)
                   at com.oracle.idm.utilities.OIMUserSearch.main(OIMUserSearch.java:71)
              Released resources
              Process exited with exit code 1.
              ------------------------

              If you look at the system.out.println statements, it looks like, code is able to get OIM handle, but failing while search API is called.

              Any pointers you would like to highlight? Note that, am using OIM 11g R1 BP4 and running the code from Jdeveloper 11.1.2

              Thanks.

              Edited by: Raghu Honawad on Nov 20, 2012 3:18 AM
              • 4. Re: Error while connecting to OIM via Jdeveloper
                Nishith Nayan
                I guess problem with login. are you able to access OIM UI using given url from this machine.
                • 5. Re: Error while connecting to OIM via Jdeveloper
                  Raghu Honawad-Oracle
                  I am able access OIM throw explorer and via design console as well from the same machine through which I am trying to execute code from Jdeveloper.
                  • 6. Re: Error while connecting to OIM via Jdeveloper
                    Kevin Pinsky
                    Download and install the latest 1.6 JDK and try again with this as your java source.

                    -Kevin
                    • 7. Re: Error while connecting to OIM via Jdeveloper
                      Raghu Honawad-Oracle
                      Dear All,

                      I was able to fix the issue by removing "iam-platform-auth-client.jar" from my classpath. It looks like either "oimclient.jar" has to be there or "iam-platform-auth-client.jar".

                      Thanks for trying to help me out.

                      Regards,
                      Raghu Honawad