[logback-user] NPE in Joran
Franck Routier
franck.routier at axege.com
Tue Sep 24 16:11:20 CEST 2013
Hi,
we are hit by a NPE while configuring Logback. Here is the stacktrace:
java.lang.NullPointerException
at java.io.File.<init>(Unknown Source)
at
ch.qos.logback.core.joran.spi.ConfigurationWatchList.convertToFile(ConfigurationWatchList.java:88)
at
ch.qos.logback.core.joran.spi.ConfigurationWatchList.addAsFileToWatch(ConfigurationWatchList.java:52)
at
ch.qos.logback.core.joran.spi.ConfigurationWatchList.setMainURL(ConfigurationWatchList.java:48)
at
ch.qos.logback.core.joran.util.ConfigurationWatchListUtil.setMainWatchURL(ConfigurationWatchListUtil.java:46)
at
ch.qos.logback.core.joran.GenericConfigurator.informContextOfURLUsedForConfiguration(GenericConfigurator.java:92)
at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:48)
at
com.axege.core.init.AxabasContextListener.contextInitialized(AxabasContextListener.java:48)
The code in AxabasContextListener looks like this:
URL confFile = this.getClass().getResource(logContextFilePath);
if (confFile != null) {
LoggerContext lc = (LoggerContext)
LoggerFactory.getILoggerFactory();
StatusManager statusManager = lc.getStatusManager();
OnConsoleStatusListener onConsoleListener = new
OnConsoleStatusListener();
statusManager.add(onConsoleListener);
try {
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(lc);
// the context was probably already configured by
default configuration rules
lc.reset();
configurator.doConfigure(confFile);
} catch (JoranException je) {
je.printStackTrace();
}
StatusPrinter.printInCaseOfErrorsOrWarnings(lc);
}
So we check if confFile exists, and it does, but we get a NPE in Joran...
The very same code works on different environments, so this is probably
due to the specific context we are deploying in, but we can't figure it
out...
Any help or pointer would be greatly appreciated.
Regards,
Franck
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4264 bytes
Desc: Signature cryptographique S/MIME
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130924/c729caef/attachment.p7s>
More information about the Logback-user
mailing list