You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Butao Zhang (Jira)" <ji...@apache.org> on 2024/10/25 07:44:00 UTC

[jira] [Assigned] (HIVE-28417) Bump log4j2 to 2.23.1 to facilitate the use of HiveServer2 JDBC Driver under GraalVM Native Image

     [ https://issues.apache.org/jira/browse/HIVE-28417?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Butao Zhang reassigned HIVE-28417:
----------------------------------

    Assignee: Qiheng He

> Bump log4j2 to 2.23.1 to facilitate the use of HiveServer2 JDBC Driver under GraalVM Native Image
> -------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-28417
>                 URL: https://issues.apache.org/jira/browse/HIVE-28417
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Qiheng He
>            Assignee: Qiheng He
>            Priority: Major
>              Labels: pull-request-available
>
> * Bump log4j2 to 2.23.1 to facilitate the use of HiveServer2 JDBC Driver under GraalVM Native Image.
>  *  apache/logging-log4j2 has eliminated various removed old JDK APIs that prevented it from being used under GraalVM Native Image since `2.24.0`. See [https://github.com/apache/logging-log4j2/issues/1539] .
>  - But apache/hive:4.0.0 is still using the old version of apache/logging-log4j2, which means that in PRs such as [https://github.com/apache/shardingsphere/pull/31526] , in order to execute unit tests related to HiveServer2 JDBC Driver under GraalVM Native Image, I have to manually exclude the dependency of Log4j2. This sounds like,
> {code:xml}
> <project>
>     <dependencies>
>        <dependency>
>           <groupId>org.apache.hive</groupId>
>           <artifactId>hive-jdbc</artifactId>
>           <version>4.0.0</version>
>        </dependency>
>        <dependency>
>           <groupId>org.apache.hive</groupId>
>           <artifactId>hive-service</artifactId>
>           <version>4.0.0</version>
>           <exclusions>
>              <exclusion>
>                 <groupId>org.apache.hadoop</groupId>
>                 <artifactId>hadoop-client-api</artifactId>
>              </exclusion>
>              <exclusion>
>                 <groupId>org.apache.logging.log4j</groupId>
>                 <artifactId>log4j-api</artifactId>
>              </exclusion>
>              <exclusion>
>                 <groupId>org.apache.logging.log4j</groupId>
>                 <artifactId>log4j-slf4j-impl</artifactId>
>              </exclusion>
>              <exclusion>
>                 <groupId>org.slf4j</groupId>
>                 <artifactId>slf4j-log4j12</artifactId>
>              </exclusion>
>           </exclusions>
>        </dependency>
>        <dependency>
>           <groupId>org.apache.hadoop</groupId>
>           <artifactId>hadoop-client-api</artifactId>
>           <version>3.3.6</version>
>        </dependency>
>     </dependencies>
> </project>
> {code}
>  - If `org.apache.logging.log4j:log4j-api` is not excluded, HiveServer2 JDBC Driver cannot be used under GraalVM Native Image, and the log is similar to the following.
> {code:bash}
> [INFO] Executing: /home/linghengqian/TwinklingLiftWorks/git/public/shardingsphere/test/native/target/native-tests --xml-output-dir /home/linghengqian/TwinklingLiftWorks/git/public/shardingsphere/test/native/target/native-test-reports -Djunit.platform.listeners.uid.tracking.output.dir=/home/linghengqian/TwinklingLiftWorks/git/public/shardingsphere/test/native/target/test-ids
> JUnit Platform on Native Image - report
> ----------------------------------------
> Failures (1):
>   JUnit Jupiter:HiveTest:assertShardingInLocalTransactions()
>     MethodSource [className = 'org.apache.shardingsphere.test.natived.jdbc.databases.HiveTest', methodName = 'assertShardingInLocalTransactions', methodParameterTypes = '']
>     => java.lang.NoClassDefFoundError: Could not initialize class org.apache.logging.log4j.LogManager
>        org.apache.commons.logging.LogAdapter$Log4jLog.<clinit>(LogAdapter.java:155)
>        org.apache.commons.logging.LogAdapter$Log4jAdapter.createLog(LogAdapter.java:122)
>        org.apache.commons.logging.LogAdapter.createLog(LogAdapter.java:89)
>        org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67)
>        org.apache.commons.logging.LogFactory.getLog(LogFactory.java:59)
>        org.apache.hadoop.fs.FileSystem.<clinit>(FileSystem.java:135)
>        java.base@22.0.2/java.lang.Class.ensureInitialized(DynamicHub.java:599)
>        java.base@22.0.2/java.lang.Class.ensureInitialized(DynamicHub.java:599)
>        java.base@22.0.2/java.lang.Class.ensureInitialized(DynamicHub.java:599)
>        org.apache.hadoop.hive.conf.valcoersion.JavaIOTmpdirVariableCoercion.<clinit>(JavaIOTmpdirVariableCoercion.java:37)
>        [...]
> {code}
> - If the Apache/Hive side can improve the version of log4j2, then to use the HiveServer2 JDBC Driver under the GraalVM Native Image, I only need to provide the GraalVM Reachability Metadata of Log4j2 in the downstream project.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)