Saturday, November 20, 2010

OIM Error - java.lang.SecurityException Unable to locate a login configuration

While working with one of the ADF custom application and trying to integrate with Oracle Identity Manager (OIM) using the exposed Java API's from oimclient.jar, I was stuck with below error: 

Exception in thread "main" java.lang.SecurityException: Unable to locate a login configuration
at com.sun.security.auth.login.ConfigFile.(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:246)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.Configuration.getConfiguration(Configuration.java:241)
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.(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.SampleOIMClient.loginWithCustomEnv(SampleOIMClient.java:91)
at model.SampleOIMClient.main(SampleOIMClient.java:155)
Caused by: java.io.IOException: Unable to locate a login configuration


as the error seems pretty obvious, it took more than good time to get through a solution.

To get through this error we need to do setting for config file. When using Java API's from oimclient.jar, program looks for  authwl.conf and this is what needs to be set as Java Options.

-Djava.security.auth.login.config=FILE_PATH\conf\authwl.conf

If you are using JDeveloper here is how you can set the same:
Go to the project properties and select Run/Debug/Profile




Select 'Default' under Run Configuration and click on Edit. Enter the property as Java Options and click ok.




Once done.. you are good to go..

3 comments:

  1. Amazing..Thanks a ton for posting this

    ReplyDelete
  2. Thanks a lot. Your posting big time helped me to proceed with my custom composite for Approval Process.

    ReplyDelete