Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class path contains multiple SLF4J bindings #3206

Closed
benmccann opened this issue Jul 23, 2014 · 14 comments
Closed

Class path contains multiple SLF4J bindings #3206

benmccann opened this issue Jul 23, 2014 · 14 comments
Milestone

Comments

@benmccann
Copy link
Contributor

From the mailing list

I just switched my app from 2.3.0 to 2.3.2

I am now getting

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/jeff/.ivy2/cache/org.slf4j/slf4j-nop/jars/slf4j-nop-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/jeff/.ivy2/cache/org.slf4j/slf4j-jdk14/jars/slf4j-jdk14-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/jeff/.ivy2/cache/org.slf4j/slf4j-simple/jars/slf4j-simple-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.helpers.NOPLoggerFactory]

Thought that we had a good workaround for jdeb's sl4j issues, but guess it wasn't enough

Fixed in jdeb and awaiting a new release. Then we'll update sbt-native-packager per the bug there

@benmccann
Copy link
Contributor Author

Submitted a pull request to fix this: #3225

@benmccann
Copy link
Contributor Author

This is now fixed. Thanks to everyone who helped

@pauldraper
Copy link
Contributor

Are there any workarounds for existing Play 2.3.2?

@benmccann
Copy link
Contributor Author

You could probably exclude the slf4j libraries and use sbt-native-packager 0.7.4 which fixes the problem. I'm not exactly sure what the exact syntax would be to exclude the bad slf4j libraries though. It seemed quite difficult to do when someone else was trying earlier. Asking on the mailing list for a Play 2.3.3 might be another route to go. I'm not sure what the current plans are for timing of releasing the fixed version.

@jaceklaskowski
Copy link
Contributor

See my answer in How to fix “SLF4J: Class path contains multiple SLF4J bindings” at startup of Play 2.3.x? that boiled down to the following changes in build.sbt:

libraryDependencies ++= Seq(
  "org.slf4j" % "slf4j-api"       % "1.7.7",
  "org.slf4j" % "jcl-over-slf4j"  % "1.7.7"
).map(_.force())

libraryDependencies ~= { _.map(_.exclude("org.slf4j", "slf4j-jdk14")) }

@jroper jroper added this to the 2.3.3 milestone Aug 12, 2014
@slimandslam
Copy link
Contributor

If you update to Play 2.3.3, then these additions to build.sbt are not necessary?

@pauldraper
Copy link
Contributor

Correct. And Play 2.3.3 was just released today.

@slimandslam
Copy link
Contributor

We've actually been getting the SLF4J warnings for some time, but I think it's because of a custom jar that we include that has duplicate bindings in it, so, 2.3.3 doesn't fix things for us. Our warnings look like this:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/someuser/Desktop/ourproject/theproject/lib/acustomjar-1.0.6.5-all2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/someuser/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.1.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/someuser/.ivy2/cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.7.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

@jinishahpatel
Copy link

I am getting the same error as @slimandslam is there a work around for this? I used the solution posted by ben and it did not work.

@benmccann
Copy link
Contributor Author

@jinishahpatel did you upgrade to Play 2.3.3? that's the recommended fix. if you still have a problem, it might be specific to your project and not an issue with play

@vader
Copy link

vader commented Nov 9, 2015

Any idea how to do this with build.scala?

@dwijnand
Copy link
Member

@benmccann I'm confused. I had identified this issue down to typesafehub/js-engine#44, for which I submitted a (still pending) pull request: typesafehub/js-engine#45. Are you sure this is fixed?

@benmccann
Copy link
Contributor Author

There could be multiple bad actor libraries and we only fixed one of them. Let's get your change to js-engine reviewed and merged. I pinged jroper to look at it, but he's been a bit busy lately, so I'm not sure if he'll respond right away. If not, you might want to ask other folks on the Play developer mailing list or chatroom if they'd be able to help. I'm afraid I haven't had much time to work on Play stuff lately either

@dwijnand
Copy link
Member

Thank you @benmccann

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants