Question & Answer
Question
IBM BigInsights:How to resolve multiple SLF4J bindings warning in hive client?
Cause
Multiple jars in the classpath having definition of class /org/slf4j/impl/StaticLoggerBinder.class
Answer
Whenever hive client or beeline is launched, multiple warnings are displayed as shown following
hive@rvm ~]$ hive
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/iop/4.1.0.0/hadoop/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/iop/4.1.0.0/spark/lib/spark-assembly-1.4.1_IBM_2-hadoop2.7.1-IBM-8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindingsfor an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
WARNING: Use "yarn jar" to launch YARN applications.
SLF4J: Class path contains multiple SLF4J bindings.
This is due to multiple jar files having definition of /org/slf4j/impl/StaticLoggerBinder.class .
To resolve this add the following line of script to /usr/iop/4.1.0.0/hive/bin/hive.distro file on all hive nodes,
CLASSPATH=`echo $CLASSPATH| sed 's/\/usr\/iop\/4\.1\.0\.0\/hadoop\/lib\/slf4j\-log4j12\-1\.7\.10\.jar//g'`
The script should be inserted after the lines
if $cygwin; then
CLASSPATH=`cygpath -p -w "$CLASSPATH"`
CLASSPATH=${CLASSPATH};${AUX_CLASSPATH}
else
CLASSPATH=${CLASSPATH}:${AUX_CLASSPATH}
fi
The warnings will no longer appear.
The script is designed to remove reference to one of the jar file in the classpath. It can be altered to suite to any jar file.
Was this topic helpful?
Document Information
Modified date:
08 April 2021
UID
swg21971864