java.lang.SecurityException: Unable to locate a login configuration
Question
Hi
I am using Bonita5.2 and the Tomcat6.0.19
I exported the application(which gives a war file and some config file and libraries) and deployed in the tomcat. When I run the application, after the login page, I get the error
description The server encountered an internal error () that prevented it from fulfilling this request. exception java.lang.SecurityException: Unable to locate a login configuration com.sun.security.auth.login.ConfigFile.(Unknown Source) sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) java.lang.reflect.Constructor.newInstance(Unknown Source) . . . .
Before starting tomcat I run a bat file with the following content:
set BONITA_OPTS="-Dorg.ow2.bonita.environment=d:\Tomcat6.0\conf\bonita-environment.xml" set LOG_OPTS="-Djava.util.logging.config.file=d:\Tomcat6.0\conf\logging.properties" set SECURITY_OPTS="-Djava.security.auth.login.config=d:\Tomcat6.0\conf\jaas-standard.cfg" set JAVA_OPTS=%JAVA_OPTS% %LOG_OPTS% %SECURITY_OPTS% %BONITA_OPTS%
I guess this error is because the jaas config file is not found. But I am sure about the paths I have mentioned.
What else could be that I am missing to configure for jaas?
Thanks
Solution 3
I have resolve this problem. I needed to put the jaas cnfig file path in the file
JAVA_HOME\jre6\lib\security\java.security
Thanks
OTHER TIPS
Specifying the jaas config file like so on the command line would work also:
-Djava.security.auth.login.config=C:/Apps/apache-tomcat-6.0.29/conf/jaas.config
I am using the Tomcat 6.0.13 extracted (not Windows service) version and I faced the similar problem.
To fix it, I simply added the the following option to catalina.bat
file:
set JAVA_OPTS=%JAVA_OPTS% "-Djava.security.auth.login.config=C:/SecureLoginModule.conf" %LOGGING_CONFIG%
It worked for me.
-- Tks
Try this:
String configFileLocation = getServletContext().getRealPath("/WEB-INF/jaas.config");
System.err.println(configFileLocation);
System.setProperty("java.security.auth.login.config", configFileLocation);
in your servlet or JSP
inside catalina.bat
under line :okhome
add the following line
set JAVA_OPTS=%JAVA_OPTS% -Djava.security.auth.login.config=%CATALINA_HOME%/conf/jaas.config
It works for me. I have that error for past 2 days and thanks you for some else post in here