简体   繁体   中英

In tomcat 8, How to provide file path in setenv.bat to read from java class

I want to have my custom java.security.auth.login.config property to be read from a user defined file from tomcat directory say TOMCAT_HOME/bin/jass.config .

:: Settings in setenv.bat ::

set "jaasFile=C:\Users\...\apache-tomcat-8.5.33\bin\jass.conf"
set "CATALINA_OPTS=%CATALINA_OPTS% -Djava.security.auth.login.config=%jaasFile%"

however if I am reading it from java class is shows as null :

System.getProperty("java.security.auth.login.config");  //  Showing as null

any hint how to achieve this?

The setenv.bat batch file is only sourced by the *.bat files distributed with Tomcat. No other method of starting the server uses that file.

If you start Tomcat from Eclipse, you can edit the JVM parameters and environment variables in the server's configuration page: double-click or hit F3 on the server in the "Servers" view to open its "Overview" page, then click on "Open launch configuration" .

If your start Tomcat as a window service, open the Procrun monitor application (renamed to tomcat*w.exe in Tomcat's installation directory) and set the values there.

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