Skip to content

Commit

Permalink
#857: Fixed tomcat login to use catalina base as parent dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
davsclaus authored and gashcrumb committed Jan 27, 2014
1 parent 282042d commit 3bae222
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Expand Up @@ -35,10 +35,15 @@ public class TomcatUserDatabaseLoginContext implements LoginModule {
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
this.subject = subject;
this.callbackHandler = callbackHandler;
this.file = new File(fileName);

String base = System.getProperty("catalina.base", ".");
LOG.debug("Using base directory: {}", base);
this.file = new File(base, fileName);

if (!file.exists()) {
throw new IllegalStateException("Apache Tomcat user database file " + file + " does not exists");
String msg = "Cannot find Apache Tomcat user database file: " + file;
LOG.warn(msg);
throw new IllegalStateException(msg);
}
}

Expand Down
3 changes: 3 additions & 0 deletions hawtio-web/src/main/webapp/WEB-INF/log4j.properties
Expand Up @@ -2,6 +2,9 @@
#
log4j.rootLogger=INFO, console, file

# to enable DEBUG or TRACE logging for hawtio
#log4j.logger.io.hawt=DEBUG

# Console will only display warnnings
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
Expand Down

0 comments on commit 3bae222

Please sign in to comment.