4 Replies Latest reply on Jan 27, 2005 11:18 AM by Ruben Verlinden

    Unable to locate a login configuration

    Ruben Verlinden Newbie

      I am using the JAAS howto to enable security for my EJB's.

      I have enabled the server side to use the JAAS based security (java:/jaas/<myapp-domain> shows in the JNDI view and whentrying to connect without logging in I get the appropriate Exception)

      When I try to create a new LoginContext using the following code :

      LoginContext lc = new LoginContext("<myapp-domain>", handler)


      I get the following Exception :
       [java] Exception in thread "main" java.lang.SecurityException: Unable to locate a login configuration
       [java] at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:97)
       [java] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
       [java] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
       [java] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
       [java] at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
       [java] at java.lang.Class.newInstance0(Class.java:308)
       [java] at java.lang.Class.newInstance(Class.java:261)
       [java] at javax.security.auth.login.Configuration$3.run(Configuration.java:221)
       [java] at java.security.AccessController.doPrivileged(Native Method)
       [java] at javax.security.auth.login.Configuration.getConfiguration(Configuration.java:215)
       [java] at javax.security.auth.login.LoginContext$1.run(LoginContext.java:170)
       [java] at java.security.AccessController.doPrivileged(Native Method)
       [java] at javax.security.auth.login.LoginContext.init(LoginContext.java:167)
       [java] at javax.security.auth.login.LoginContext.<init>(LoginContext.java:404)
       [java] at vub.starlab.ds.ontobase.ejb.TestOntoBaseFacadeEJB.main(Unknown Source)
       [java] Caused by: java.io.IOException: Unable to locate a login configuration
       [java] at com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:206)
       [java] at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:95)
       [java] ... 14 more
       [java] Java Result: 1
      


      In the example code I don't see any login configuration file. Which file should this be and what should it contain?

      Ruben