jeudi 22 janvier 2015

Eclipse can't find logback-test.xml on my classpath for unit tests

I'm struggling with getting Eclipse to recognize my logging configuration when I quick run tests from within Eclipse (Alt + Shift + X, T), or by running from the Run Configurations. I really don't care all that much about logging from the tests per se, but really just providing the configuration so that any log statements executed will not fail.





Failed to instantiate [ch.qos.logback.classic.LoggerContext]
Reported exception:
java.lang.NoSuchMethodError: ch.qos.logback.core.util.Loader.getResourceOccurrenceCount(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljava/util/Set;
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.getResource(ContextInitializer.java:141)
at ch.qos.logback.classic.util.ContextInitializer.findURLOfDefaultConfigurationFile(ContextInitializer.java:130)
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:144)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:123)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:337)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:287)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:309)



I have logback-test.xml in src/test/resources, and have configured that as a source folder with an output of target/test-classes.


enter image description here enter image description here


I even took at shot at editing the Classpath of the Run Configuration for JUnit for my project, and added the test-classes folder there, and it didn't help.


enter image description here


Is there something simple that I'm missing? I don't seem to recall having this issue in the past with other projects.


Aucun commentaire:

Enregistrer un commentaire