Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-8246 Java 11/17 Support and Testing
  3. HDDS-11392

ChecksumByteBufferImpl's static initializer fails with java 17+

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4.0
    • 2.0.0
    • None

    Description

      ChecksumByteBufferImpl's static initializer fails with:

      ava.lang.reflect.InaccessibleObjectException: Unable to make field boolean java.nio.ByteBuffer.isReadOnly accessible: module java.base does not "opens java.nio" to unnamed module @46d56d67
      	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
      	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
      	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
      	at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
      	at org.apache.hadoop.ozone.common.ChecksumByteBufferImpl.<clinit>(ChecksumByteBufferImpl.java:51)
      

      This exception appears with Java 17 and above as I tested it, it works for Java 9 and 11, however there is a way (according to the comment in the initializer) in Java 9 which we can use and which is identical to what we are doing with setting the field in Java 8.

      So I propose to use that from Java 9, and do not try to set the isReadOnly field accessible after Java 8.

      Attachments

        Issue Links

          Activity

            People

              pifta István Fajth
              pifta István Fajth
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: