Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-28417

Bump log4j2 to 2.23.1 to facilitate the use of HiveServer2 JDBC Driver under GraalVM Native Image

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      • Bump log4j2 to 2.23.1 to facilitate the use of HiveServer2 JDBC Driver under GraalVM Native Image.
      • 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,
      <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>
      
      • 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.
      [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)
             [...]
      
      • 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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              linghengqian Qiheng He
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: