Logback NPE in Felix OSGi container.

I'm hitting an NPE in logger initialization in the Felix OSGi container if I specify the logback.configurationFile system property. Without the system property, I don't hit this and everything logs to the ConsoleAppender as expected. Any suggestions as to how to fix this? java.lang.NullPointerException at ch.qos.logback.core.util.Loader.getResourceOccurenceCount(Loader.java:58) at ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning(ContextInitializer.java:160) at ch.qos.logback.classic.util.ContextInitializer.statusOnResourceSearch(ContextInitializer.java:183) at ch.qos.logback.classic.util.ContextInitializer.findConfigFileURLFromSystemProperties(ContextInitializer.java:111) at ch.qos.logback.classic.util.ContextInitializer.findURLOfDefaultConfigurationFile(ContextInitializer.java:120) at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:148) at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85) at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55) at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241) at com.weiglewilczek.slf4s.Logger$.apply(logger.scala:32) at com.weiglewilczek.scalamodules.package$.<init>(package.scala:84) at com.weiglewilczek.scalamodules.package$.<clinit>(package.scala) at com.smiley.validation.create.Activator.start(Activator.scala:22) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:633) at org.apache.felix.framework.Felix.activateBundle(Felix.java:1822) at org.apache.felix.framework.Felix.startBundle(Felix.java:1739) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1143) at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264) at java.lang.Thread.run(Thread.java:637) CONFIDENTIALITY NOTICE: This e-mail message is covered by the Electronic Communications Privacy Act, 18 U.S.C. §2510-2521 and, together with any attachments, is intended only for the addressee. If you are not the intended recipient of this message, you may not disclose, print, copy, or disseminate this information. If you have received this in error, please reply and notify the sender (only) and delete the message along with any attachments. Unauthorized interception of this email is a violation of federal criminal law. If your company has signed a confidentiality agreement with Smiley Media, the content of this email is designated 'Confidential Information' within the meaning of that agreement.

In the getResourceOccurenceCount method of the ch.qos.logback.core.util.Loader class, it is assumed that the getResource method of the class loader instance will return a non-null enumeration. This assumption does apparently not hold in Felix. Please enter a bug report so that we can fix the issue. On 13/10/2010 9:18 PM, Mark Protas wrote:
I'm hitting an NPE in logger initialization in the Felix OSGi container if I specify the logback.configurationFile system property. Without the system property, I don't hit this and everything logs to the ConsoleAppender as expected. Any suggestions as to how to fix this?
java.lang.NullPointerException at ch.qos.logback.core.util.Loader.getResourceOccurenceCount(Loader.java:58) at ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning(ContextInitializer.java:160) at ch.qos.logback.classic.util.ContextInitializer.statusOnResourceSearch(ContextInitializer.java:183) at ch.qos.logback.classic.util.ContextInitializer.findConfigFileURLFromSystemProperties(ContextInitializer.java:111) at ch.qos.logback.classic.util.ContextInitializer.findURLOfDefaultConfigurationFile(ContextInitializer.java:120) at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:148) at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85) at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55) at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241) at com.weiglewilczek.slf4s.Logger$.apply(logger.scala:32) at com.weiglewilczek.scalamodules.package$.<init>(package.scala:84) at com.weiglewilczek.scalamodules.package$.<clinit>(package.scala) at com.smiley.validation.create.Activator.start(Activator.scala:22) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:633) at org.apache.felix.framework.Felix.activateBundle(Felix.java:1822) at org.apache.felix.framework.Felix.startBundle(Felix.java:1739) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1143) at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264) at java.lang.Thread.run(Thread.java:637)
participants (2)
-
Ceki Gülcü
-
Mark Protas