running hive 0.12 with error of slf4j

2019-01-28 19:05发布

问题:

Logging initialized using configuration in jar:file:/usr/local/hive/lib/hive-common-0.12.0.jar!/hive-log4j.properties

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12-    1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hive/lib/slf4j-log4j12-1.6.1.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]

hive>

回答1:

you need to delete these jar files binding between Hadoop and Hive

  • rm lib/hive-jdbc-2.0.0-standalone.jar
  • rm lib/log4j-slf4j-impl-2.4.1.jar


回答2:

Of the 2 SLF4J bindings being listed in the warning you'll need to exclude one of them from the classpath.

Even though this is a warning SLF4J will pick one logging framework/implementation and bind with it - binding is determined by the JVM and is mostly considered a random function.



回答3:

You are getting such warning message because of conflicts sl4j.jar which is being used from HIVE and HADOOP path. In order to get rid of this thing just delete hive-jdbc-1.1.0-standalone.jar from /usr/local/hive/lib. Then you should good to go ... :)



回答4:

you have to delete /usr/local/hive/lib/slf4j-log4j12-1.6.1.jar because hive will automatically use slf4j-log4j jar file present in hadoop.

you can also refer here https://issues.apache.org/jira/browse/HIVE-6162



回答5:

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\/local\/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.

http://www-01.ibm.com/support/docview.wss?uid=swg21971864