user2083783
user2083783

Reputation: 31

Grails jar dependency duplicated log4j binding

I have a Grails application running that uses grails-plugin-log4j. At the same time, I've recently added some jar files in order to integrate an external funcitonality to my platform, However, one of this JARs its slf4j-jdk14-1.7.2 that is a dependency from the main .jar file of the functionality.

Obviously when I refresh project's dependencies I get the following message:

Error SLF4J: Class path contains multiple SLF4J bindings

I've tried to exclude grails-plugin-log4j from BuildConfig but unfortunately the app doesn't run when log messages are sent to log4j. I've tried also to exclude the other dependency but I don't know how exclude it because I've imported too many jar files to include the new functionality...

Any clues on that?

Thanks!

Upvotes: 1

Views: 868

Answers (1)

Aiden Zhao
Aiden Zhao

Reputation: 574

As @dmahapatro said, user grails command to do the grails dependency-report first. Search for log4j or slf4j. See if there is any duplicate. Then, in your BuildConfig.groovy, use

runtime('com.mysql:mysql-connector-java:5.1.16',
        'net.sf.ehcache:ehcache:1.6.1') {
    excludes "xml-apis", "commons-logging"//exclude the duplicate jar, may not be these two
}

Upvotes: 1

Related Questions