Reputation: 596
In my project, i am using :
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.2</version>
</dependency>
I can not remove it, because a lot of other dependencies use it. App is working with LDAP,so ecently i have add:
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-all</artifactId>
<version>1.5.5</version>
</dependency>
Which is depends from:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.2</version>
</dependency>
And now i have a lot of errors:
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.error(SLF4JLocationAwareLog.java:225)
Can you please help me? Yep, I see this question
Upvotes: 1
Views: 3679
Reputation: 5009
Maven should be picking the latest version, but you could try adding a dependency management section, to explicitly specify which version of slf4j you want. Probably picking the most recent version out of all your various dependencies will be fine (1.7.2 in this case).
Alternatively, I've come across this issue when deploying an application into jboss, because it bundles an old version of slf4j, which takes precedence over the version in my application. You can check this by running your application (or jboss or whatever) with the -verbose:class
jvm parameter, it will log out where each class is being loaded from. This would tell you if it's being loaded from the jar in your application, or something in your environment.
Upvotes: 1
Reputation: 16516
You could:
1.5.7
which is the latest 1.x
version. It depends on slf4j-log4j12:1.5.10
, so this unlikely will help.apacheds-all:2.0.0-M15
. It depends on slf4j-log4j12:1.7.5
so if this version suits you, it should resolve this problem.UPDATE
Some other ideas:
Upvotes: 3