1 Reply Latest reply: Dec 7, 2012 4:24 PM by Rajiv Dewan RSS

    Accessing OIM Services using Jdeveloper:Unable to locate a login confi

    961125
      hello experts,
      Am trying to access OIM services using oim client in jdeveloper and the code for sample class is shown below::
      package model;

      import javax.security.auth.login.LoginException;

      import oracle.iam.platform.OIMClient;
      import java.util.Dictionary;
      import java.util.Hashtable;


      public class Class1{
      public static OIMClient client;
      private static String OIMUserName = "xelsysadm";
      private static String OIMPassword = "Oracle_7";
      private static String OIMURL = "t3://192.168.1.2:14000";
      private static String OIMInitialContextFactory = "weblogic.jndi.WLInitialContextFactory";

      public static void loginWithCustomEnv() throws LoginException {
      Hashtable env = new Hashtable();
      env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL, OIMInitialContextFactory);
      env.put(OIMClient.JAVA_NAMING_PROVIDER_URL, OIMURL);
      client = new OIMClient(env);
      client.login(OIMUserName, OIMPassword);
      }

      public static void main(String args[]) {
      try {
      loginWithCustomEnv();
      } catch (LoginException e) {
      e.printStackTrace();
      }
      }
      }


      and am getting the folllowing error in compilation

      xception in thread "main" java.lang.SecurityException: Unable to locate a login configuration
           at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:93)
           at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
           at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
           at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
           at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
           at java.lang.Class.newInstance0(Class.java:355)
           at java.lang.Class.newInstance(Class.java:308)
           at javax.security.auth.login.Configuration$3.run(Configuration.java:247)
           at java.security.AccessController.doPrivileged(Native Method)
           at javax.security.auth.login.Configuration.getConfiguration(Configuration.java:242)
           at javax.security.auth.login.LoginContext$1.run(LoginContext.java:237)
           at java.security.AccessController.doPrivileged(Native Method)
           at javax.security.auth.login.LoginContext.init(LoginContext.java:234)
           at javax.security.auth.login.LoginContext.<init>(LoginContext.java:403)
           at Thor.API.Security.LoginHandler.weblogicLoginHandler.login(weblogicLoginHandler.java:58)
           at oracle.iam.platform.OIMClient.login(OIMClient.java:134)
           at oracle.iam.platform.OIMClient.login(OIMClient.java:114)
           at model.Class1.loginWithCustomEnv(Class1.java:22)
           at model.Class1.main(Class1.java:27)
      Caused by: java.io.IOException: Unable to locate a login configuration
           at com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:250)
           at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:91)
           ... 18 more


      and it is due to authwl.conf not found, and i have found that i need to set the Java Options to
      -DXL.HomeDir=PATH\OIM
      -Djava.security.auth.login.config=FILE_PATH\conf\authwl.conf

      but in jdeveloper am not able to find the location for the same. please elaborate...


      Regards,
      KK