【发布时间】:2022-01-04 10:38:34
【问题描述】:
我有一个使用 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 库 目前:
./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
但是,Hive 服务 (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 来进行这样的修复甚至是可行的?
谢谢!!
【问题讨论】: