I am trying to load a Video using OpenIMAJ. It does Display the Video but always shows me this Error:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/MaryLu/.m2/repository/ch/qos/logback/logback-classic/1.0.0/logback-classic-1.0.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/MaryLu/.m2/repository/org/slf4j/slf4j-log4j12/1.7.2/slf4j-log4j12-1.7.2.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 [ch.qos.logback.classic.selector.DefaultContextSelector]
16/04/24 20:39:57 INFO xuggle.XuggleVideo: URL file:/F:/workspaceMaven/keyboardcat.flv could not be opened by ffmpeg. Trying to open a stream to the URL instead.
20:39:57.984 [main] DEBUG com.xuggle.xuggler - Could not open output url: file:/F:/workspaceMaven/keyboardcat.flv (../../../../../../../csrc/com/xuggle/xuggler/Container.cpp:436)
I already checked Similar Questions but I didn't manage to solve the problem. If i understood, i need to exclude slf4j somewhere in my POM.xml but i don't really know in which dependency.
Already the answer is given in your log file. Follow the tutorial.
http://www.slf4j.org/codes.html#multiple_bindings
As Wouter stated
Run mvn dependency:tree and search which dependency have the slf4j implementations you do not want, then exclude them with a dependency exclusion like:
<dependency>
<groupId>org.someexternallib</groupId>
<artifactId>someexternallibartifact</artifactId>
<version>...</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
The slf4j messages is just telling you that your slf4j configuration is broken so it falls back to a default configuration.
The real problem is that your URL does not point to a local file as you apparently expect it to because it is broken, so the code trying to use it fails. A possible reason for the brokenness might be if you have the file open already somewhere, so Windows will not allow it to be overwritten.
<exclusion>
<artifactId>logback-classic</artifactId>
<groupId>ch.qos.logback</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-simple</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
In order to find the dependencies that use above artifact, find out by
"$ mvn dependency:tree"
once you find that out put the above exclusions on the corresponding dependencies. That should fix it, I would say pay attention on specific dependencies.
Related
My pom.xml contains only one reference to SLF4J:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.5.10</version>
</dependency>
I am getting this error:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J:
See http://www.slf4j.org/codes.html#StaticLoggerBinder for further
details.
I checked that URL and indeed it provides a solution: "Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem. "
My question is: which classpath?
The system's %CLASSPATH%? (I don't have one! I will need to create it specifically for this)
Eclipse's project .classpath? (I think I tried this but it didn't help)
Other?
I found quite a few postings on the subject here on SO, but they all quote the same answer: "place ... on the class path".
Which classpath?
First of all in order to add SLF4J you should put ONE and only ONE of these dependencies in your pom.xml. It depends on what implementation you choose to use. Every dependency you add in the pom.xml is added automatically in the classpath. As long as you are using Eclipse there is no need to modify the system's %CLASSPATH%?
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version></version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version></version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version></version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version></version>
<scope>compile</scope>
</dependency>
Last but not least you will have the error SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
Eclipse Juno and Indigo, when using the bundled maven version(m2e), are not suppressing the message SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". This behaviour is present from the m2e version 1.1.0.20120530-0009 and onwards.
Although, this is indicated as an error your logs will be saved normally. The highlighted error will still be present until there is a fix of this bug. More about this in the m2e support site.
The current available solution in order to suppress this message is to use an external maven version rather than the bundled version of Eclipse. You can find about this solution and more details regarding this bug in the question below.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". error
Problem:
I'm using Maven to manage my dependencies. In my case, the reason I was getting this error was because I had more than one slf4j-simple jar in my system on my class path. The SLF4J documentation states:
Placing one (and only one) of slf4j-nop.jar slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem.
Solution:
Search for the following jars in your file system and remove all copies other than the one in .m3:
slf4j-nop
slf4j-simple
slf4j-log4j12
slf4j-jdk14
logback-classic
I'm building a Java API and this happens on my vsCode when I try to debug my main class :
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/CDINDELE/.m2/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
I know this is a exclusion issue, so I've excluded the slf4j from my dependencies like this:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-over-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
It works well with mvn install, and my API is working great with
java -jar myWar
However when I'm trying to use the debug with vscode on my main class (using the java plugin) the issue is coming back so it's impossible for me to debug this app which is not very convenient.
Any ideas ? Thanks
I get the following error:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/Vash/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/Vash/.m2/repository/org/slf4j/slf4j-jdk14/1.7.25/slf4j-jdk14-1.7.25.jar!/org/slf4j /impl/StaticLoggerBinder.class]
I've already checked https://www.slf4j.org/codes.html#multiple_bindings
and similar questions. I've found using mvn dependency:tree that 4 dependencies use SLF4J so I've added the exclusion to them like this:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
This didn't change anything and I still get the same error. I've tried deleting the .jar files specified in the warning but then I get error about missing classes. Also I'm using IntelliJ so maybe somehow reloading the pom.xml file is the issue here?
I think this is a bug/feature in Maven. Let's assume you have this dependency tree:
A
+---B
+---C
| +---D
|
+---D
and you exclude D on B, it will still be there because C also pulls it in. From Maven's point of view this makes sense because it doesn't try to understand whether there is a relationship between B and C. We know that they're all from Spring but Maven can't be so sure.
Solution: You need to duplicate the exclusion on C in your POM.
Use mvn dependency:tree to find all places where D is being used and add one exclusion each.
And make sure you actually exclude D. In your example above, you exclude org.slf4j:slf4j-log4j12 instead of org.slf4j:slf4j-jdk14
I have a problem with slf4j dependencies.
On POM.xml, i declared this:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.12</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.12</version>
</dependency>
But i meet this error message:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/C:/Users/r.rossi/.m2/repository/org/slf4j/slf4j-
nop/1.5.3/slf4j-nop-1.5.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in
[jar:file:/C:/Users/r.rossi/.m2/repository/org/slf4j/slf4j-
jdk14/1.5.6/slf4j-jdk14-
1.5.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in
[jar:file:/C:/Users/r.rossi/.m2/repository/org/slf4j/slf4j-
log4j12/1.7.12/slf4j-log4j12-
1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
explanation.
SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding.
SLF4J: Your binding is version 1.5.5 or earlier.
SLF4J: Upgrade your binding to version 1.6.x.
On those directorties and on maven dependencies i have 1.5 versions but i don't have them on POM.xml file (as you can see), so i don't know how delete them. If i delete the directories, it works but the next esecution the project download again the 1.5 versions. How can i delete those damned 1.5 versions?
As the error stack suggest check the link Multiple Binding.
Also, check Dependency Tree to check which external dependency is trying to include (1.5.5 or earlier version).
Basically, your exclusion code
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
should be inserted inside that dependency which depends on an earlier version 1.5.5.
I created default Drools project, tried to launch it, but I have this error:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
what's wrong? I didn't change anything in project. Btw I have no pom.xml file, should I create one?
I checked some solutions, but nothing helps, please help
Add a runtime dependency to logback-classic. Or if you don't use maven/gradle/etc, then add the logback-classic jar in your classpath.
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>runtime</scope>
</dependency>
See http://www.slf4j.org for more information and other options.