Hive 2.0 log4j漏洞修补问题



我有一个使用Hive 2.0.0和Hadoop 2.6.0的模拟项目,我正在研究解决最近的log4j漏洞。

其中几个选项是:

  • 将Hive升级到解决该漏洞的最新版本-这将是一个复杂的更改,会有很多破坏性的代码更改
  • 修补Hive 2.0.0,使用最新的log4j jar(2.17.1(解决漏洞
  • 删除JndiLookup.class和其他配置设置以立即修正-我能够成功地做到这一点

Hive 2.0.0使用log4j版本2.4.1,我目前正试图通过用2.17.1 jar替换2.4.1 jar来修补Hive libs目前:

./lib/ | grep log4j
log4j-1.2-api-2.4.1.jar
log4j-api-2.4.1.jar
log4j-core-2.4.1.jar
log4j-slf4j-impl-2.4.1.jar
log4j-web-2.4.1.jar

后补丁:

./lib/ | grep log4j
log4j-1.2-api-2.17.1.jar
log4j-api-2.17.1.jar
log4j-core-2.17.1.jar
log4j-slf4j-impl-2.17.1.jar
log4j-web-2.17.1.jar

但是,配置单元服务(cli/hiveserver2(在jar更改后不会启动,并在启动过程中中断,出现以下错误:

ERROR StatusLogger Unrecognized format specifier [thread]
ERROR StatusLogger Unrecognized conversion specifier [thread] starting at position 25 in conversion pattern.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/lib/hive-jdbc-2.0.0-standalone.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/lib/log4j-slf4j-impl-2.17.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.apache.logging.slf4j.Log4jLoggerFactory]
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.debug(Ljava/lang/String;Ljava/lang/Object;)V
at org.apache.logging.log4j.core.config.yaml.YamlConfigurationFactory.<init>(YamlConfigurationFactory.java:48)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
....
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.logging.log4j.core.util.ReflectionUtil.instantiate(ReflectionUtil.java:188)
at org.apache.logging.log4j.core.config.ConfigurationFactory.addFactory(ConfigurationFactory.java:183)
at org.apache.logging.log4j.core.config.ConfigurationFactory.getInstance(ConfigurationFactory.java:157)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:519)
....
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:221)
at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:140)
....
at org.apache.hadoop.hive.common.LogUtils.initHiveLog4jDefault(LogUtils.java:121)
at org.apache.hadoop.hive.common.LogUtils.initHiveLog4jCommon(LogUtils.java:73)
at org.apache.hadoop.hive.common.LogUtils.initHiveLog4j(LogUtils.java:54)
at org.apache.hive.service.server.HiveServer2.main(HiveServer2.java:631)

有什么可能出错的建议吗?或者甚至用最新版本替换jar来进行这样的修复是可行的?

谢谢!!

STOP,您不能只是替换一个jar并希望新版本能够工作。这可能适用于较小的版本更改。(2.4.X(但大多数肯定不会对主要版本更改起作用(2.X(

执行以下操作,然后更换前一个罐子。

遵循log4j:的指导

否则,在2.16.0以外的任何版本中,您都可以删除类路径中的JndiLookup类:zip-q-d log4j core-*.jarorg/apache/logging/log4j/core/lolooking/JndiLookup.class

基本上它是说解压缩jar,删除类文件,将其压缩回来,然后你就可以使用它了。如果你做到了,你就很好了。您需要等待来自apache的新版本的Hive才能获得log4j的升级版本。

最新更新