Spring framework throws
Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:159)
at org.springframework.context.support.AbstractApplicationContext.prepareRefresh(AbstractApplicationContext.java:454)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:392)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
what's the reason?
The reason is wrong version of library added (version conflict).
Check for the version of slf4j
's javadoc and try to figure out ,this method exist with which version ?
If you are running OSX you might find this is because the following files are included as java extensions:
/Library/Java/Extensions/slf4j-api-1.5.8.jar
/Library/Java/Extensions/slf4j-log4j12-1.5.8.jar
These are loaded by the extension classloader, before your application classloader, so these will be resolved first.
I have no idea why these are there or when they were added but i've only seen this on OSX and in the last year, which might imply they were introduced in java 6.
You can remove\move the files to workaround the problem, but there might be some applications which depend on them.
You might be having a class twice in your classpath.
Check the classpath for the occurrences.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With