
[ http://jira.qos.ch/browse/LBCLASSIC-120?page=com.atlassian.jira.plugin.syste... ] Hugues Malphettes commented on LBCLASSIC-120: --------------------------------------------- No such problem for me when running logback in an OSGi environment: "WORKSFORME"?
Joran configuration not working in OSGi environment ---------------------------------------------------
Key: LBCLASSIC-120 URL: http://jira.qos.ch/browse/LBCLASSIC-120 Project: logback-classic Issue Type: Bug Components: joran Affects Versions: 0.9.15 Environment: OSGi Service Platform Release 4 Reporter: Pavol Juhos Assignee: Ceki Gulcu
When running in OSGi environment, JoranConfigurator throws a ClassCastException when trying to parse the Logback XML configuration file. The problem seems to be caused by OSGi-unfriendly JAXP parser discovery mechanism as suggested by Dieter Wimberger in his blog post -- http://wimpi.coalevo.net/2008/04/hack-how-to-use-logback.html "[...] JAXP discovery mechanism assume visibility of the parser through the context ClassLoader of the actual thread, which may cause some troubles." Observed exception stack trace: Failed to auto configure default logger context Reported exception: ch.qos.logback.core.joran.spi.JoranException: Parser configuration error occured at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(SaxEventRecorder.java:63) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:105) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:76) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:40) at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:47) at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:108) at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85) at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:56) at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:189) at org.slf4j.LoggerFactory.bind(LoggerFactory.java:112) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:105) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:235) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:208) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:221) at com.foo.bar.server.config.Configuration.<clinit>(Configuration.java:244) at com.foo.bar.server.ServerBundleActivator.start(ServerBundleActivator.java:39) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589) at org.apache.felix.framework.Felix._startBundle(Felix.java:1671) at org.apache.felix.framework.Felix.startBundle(Felix.java:1588) at org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:1180) at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:265) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassCastException: org.apache.xerces.jaxp.SAXParserFactoryImpl at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source) at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(SaxEventRecorder.java:56) ... 21 more
-- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira