简体   繁体   中英

JAAS login configuration error on Tomcat. Unable to loas JAAS config file

I am trying to implement a simple JAAS module with realm configuration on Tomcat 7. I am trying to implement this based on the following link:

http://www.byteslounge.com/tutorials/jaas-authentication-in-tomcat-example

I have placed jass.config in CATALINA_HOME/conf folder and have added the following code to CATALINA_HOME/bin/catalina.bat file

JAVA_OPTS=$JAVA_OPTS "-Djava.security.auth.login.config==$CATALINA_HOME/conf/jaas.config"     

However, once I start Tomcat and attempt to access the protected admin.html page, I get the basic login dialog of the browser (as expected). But while trying to log in, Tomcat reports the following error:

SEVERE: Unexpected error
java.lang.SecurityException: Unable to locate a login configuration

Please help how to make Tomcat find the JAAS config file.

The fact that you're using .bat file suggests you're using Windows where variables get referred to using %VARIABLE% notation instead of $VARIABLE . Try changing the expression to:

set JAVA_OPTS=%JAVA_OPTS% -Djava.security.auth.login.config=%CATALINA_HOME%/conf/jaas.config

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM