SoapUI SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder” - java

How to resolve the problem of 'SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”' when running SoapUI (mine is 5.2.1) command-line testrunner.bat?
NOTE: This problem had been answered in a number of places for Maven, Eclipse, etc. but not for SoapUI. E.g.:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". in a Maven Project

The problem, as explained in http://www.slf4j.org/codes.html is that one (and only one) of the following is missing in the classpath: slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar.
I found that adding, e.g. slf4j-simple.jar to [SoapUI-Base]/bin/ext did not work, even though it apparently loaded it:
13:02:26,203 INFO [SoapUI] Adding [C:\Program Files\SmartBear\SoapUI-5.2.1\bin\ext\slf4j-simple-1.6.1.jar] to extensions classpath
13:02:26,983 INFO [DefaultSoapUICore] initialized soapui-settings from [C:\Users\XXX\soapui-settings.xml]
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
What worked was to place slf4j-simple.jar, and more specifically, slf4j-simple-1.6.1.jar (to be compatible with the SLF4J version used in SoapUI 5.2.1) into [SoapUI-Base]/lib.
Hope this helps.

this is solution that help me.
I have downloaded last slf4j package from http://www.slf4j.org/download.html
Delete from SmartBear\SoapUI-5.2.1\lib file slf4j-api
Insert to the SmartBear\SoapUI-5.2.1\lib files from package slf4j-api and slf4j-nop
Now everything works fine.

Related

How to solve SLF4J exception [duplicate]

This question already has answers here:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"
(35 answers)
Closed 7 years ago.
I am using Tess4j API in creating an OCR system. But after I running he program it gives the following message in Apache Tomcat.
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 have inserted all the required jar files and dll files. But I don't get the text extracted from the provided image. Is this due to the above message? Please help me.Thank you in advance
As mentioned on http://www.slf4j.org/codes.html
This error is reported when the org.slf4j.impl.StaticLoggerBinder
class could not be loaded into memory. This happens when no
appropriate SLF4J binding could be found on the class path. 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.
Did you also bind the jar files on your class path?

Maven SLF4J: Class path contains multiple SLF4J bindings [External dependencies]

I know I can exclude one of the binding which I did in maven so my springboot.jar only contains logback and logback-slf bindings but then there is this external jar that I am referring on spring-boot class path introduces slf4j-log4j binding at runtime and gets confused.
java -Dprofile=dev -Dloader.path=springboot.jar,/usr/local/hadoop/lib,/usr/local/hbase/lib -jar springboot.jar
SLF4J: Found binding in [jar:file:/runtime/external/classpath/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/build/jar/path/springboot.jar!/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
How do I resolved this when binding conflict is with external dependencies?
Thanks
You have to somehow exclude those jars from your classpath. So you shouldn't add the hbase lib dir in general, but enumerate all jarfiles.
In case you are using bash to start your application you can leverage its pattern matching: /usr/local/hbase/lib/!(slf4j-log4j12-*)
p.s. this is not a spring-boot question....

SLF4J Defaulting to Log4j over logback even when binding doesn't exist

I am trying to get SLF4J to bind to logback, but it is instead defaulting to Log4j.
I have all the default config files configured for logback, as well as the bindings.
My classpath has the following relevant jars:
logback-classic
commons-logging (99.0-does-not-exist) //empty jar to exclude commons-logging
logback-core
logback-ext-spring
Note: No log4j dependencies are present.
This is a spring mvc app.
On startup SLF4J has the following output:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/masierp/Documents/springsource/vfabric-tc-server-developer-2.8.2.RELEASE/blablahbkla/wtpwebapps/ilm-engine/WEB-INF/lib/activemq-all-5.7.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/masierp/Documents/springsource/vfabric-tc-server-developer-2.8.2.RELEASE/blablahbkla/wtpwebapps/ilm-engine/WEB-INF/lib/logback-classic-1.1.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 [org.slf4j.impl.Log4jLoggerFactory]
Note that none of the found bindings are log4j bindings.
I have messed with spring-ext (trying to use it as the spring listener) but with or without this jar the problem persists.
Any help appreciated, thanks.
Probably one of your dependencies has a log4j dependency. You need to exclude it.
Try to look on the parent pom.

multiple slf4j bindings in Eclipse RCP Plugin

I have a simple Eclipse Plugin which gives me following error on activation:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [bundleresource://103.fwk8918249:1/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [bundleresource://103.fwk8918249:4/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
both URLs resolve to the exact same jar in the bundle
libs/slf4j-log4j12.jar!/org/slf4j/impl/StaticLoggerBinder.class
How can i solve the problem?
How come that the bundle loads the jar twice (":1" and ":4")?
This is a result of defining an SLF4J binding in both your project's classpath (JDT .classpath file) and your MANIFEST.MF file.
You should remove your SLF4J binding from your project's class path:
YourProject → Properties → Java Build Path → Libraries
Select the SLF4J Binding JAR and hit 'Remove'.
Once you do this, there should only be a single reference to your SLF4J binding in your class loader (and thus the error message should not appear).
For me the issue occurred due to an installed plugin. To find out which one it is.. look for the file SavedExternalPluginList.txt in the metadata of the debugging eclipse instance, e.g.
runtime-EclipseApplication\.metadata\.plugins\org.eclipse.pde.core\SavedExternalPluginList.txt
and search for slf4j. This way you get an idea which plugins might be responsible. I found following entries:
file:/D:/EclipseJava/App/Eclipse/plugins/ch.qos.logback.slf4j_1.0.7.v201505121915.jar
file:/D:/EclipseJava/App/Eclipse/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.7.0.20160603-1931/
file:/D:/EclipseJava/App/Eclipse/plugins/org.slf4j.api_1.7.2.v20121108-1250.jar
file:/D:/EclipseJava/App/Eclipse/plugins/org.slf4j.impl.log4j12_1.7.2.v20131105-2200.jar
Disabling the plugin ch.qos.logback.slf4j for my Target Platform did the trick:
If you manually change the plugin selection, please be careful and use the Validate Plug-ins feature to make sure you don't create other issues.
This seems to solve the problem:
SLF4J: Class path contains multiple SLF4J bindings
If not, do you have two different versions of SLF4J on that path?

Does slf4j use commons-logging implementation by default?

I have only worked with log4j in the past. Now I am scouting a new project and noticing that it uses slf4j 1.7.2. I understand it is only an API specification which provides a simplified interface (AKA facade) to various implementations that conform to it, such as java.util.logging, log4j and logback. However, I noticed that commons-logging wasn't mentioned in the list on the API web site, however, its jar was in this app's classpath. When I removed it from the classpath to check whether it was the used implemetation, I confirmed that it indeed was:
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.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
Is commons-logging indeed the default implementation for slf4j? Because their documentation says:
If no binding is found on the class path, then SLF4J will default to a no-operation implementation.
at the above linked page. And even though I have slf4j-nop-1.7.2.jar in the classpath, which I am guessing the default implementation referred to above is, I still get the exception asking for org/apache/commons/logging/LogFactory if the commons is not in the classpath, so I am confused.
A clarification would be appreciated.
You need a combination of the binding jar AND the logging implementation (JCL in this case) on the classpath.
Binding with a logging framework at deployment time
commons-logging is not the default, but if you have slf4j-jcl-1.7.2.jar on your classpath, it will try to use that. So if you therefore remove JCL from your path, it will complain that it can't find the classes.
slf4j-nop-1.7.2.jar is the no-op "SLF4J bindings" jar, not an implementation in itself.

Categories