Bug: Export necessary modules when running under JDK11
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 17/Sep/20 17:06
Affects Version/s: 2.3.0

Running on JDK11, I noticed this in the debug logging. It looks like netty is using {{sun.misc.Unsafe}} instead of the new location on jdk11.

{noformat}
2020-09-17 00:21:53,318 DEBUG org.apache.hbase.thirdparty.io.netty.util.internal.PlatformDependent0: jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable
java.lang.IllegalAccessException: class org.apache.hbase.thirdparty.io.netty.util.internal.PlatformDependent0$6 cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @78461bc4
        at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
        at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:591)
        at java.base/java.lang.reflect.Method.invoke(Method.java:558)
        at org.apache.hbase.thirdparty.io.netty.util.internal.PlatformDependent0$6.run(PlatformDependent0.java:335)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at org.apache.hbase.thirdparty.io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:326)
        at org.apache.hbase.thirdparty.io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:289)
        at org.apache.hbase.thirdparty.io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:92)
        at org.apache.hbase.thirdparty.io.netty.channel.epoll.Native.loadNativeLibrary(Native.java:228)
        at org.apache.hbase.thirdparty.io.netty.channel.epoll.Native.<clinit>(Native.java:58)
        at org.apache.hbase.thirdparty.io.netty.channel.epoll.Epoll.<clinit>(Epoll.java:39)
        at org.apache.hbase.thirdparty.io.netty.channel.epoll.EpollEventLoop.<clinit>(EpollEventLoop.java:51)
        at org.apache.hbase.thirdparty.io.netty.channel.epoll.EpollEventLoopGroup.newChild(EpollEventLoopGroup.java:150)
        at org.apache.hbase.thirdparty.io.netty.channel.epoll.EpollEventLoopGroup.newChild(EpollEventLoopGroup.java:35)
        at org.apache.hbase.thirdparty.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:84)
        at org.apache.hbase.thirdparty.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:58)
        at org.apache.hbase.thirdparty.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:47)
        at org.apache.hbase.thirdparty.io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:59)
        at org.apache.hbase.thirdparty.io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:112)
        at org.apache.hbase.thirdparty.io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:99)
        at org.apache.hbase.thirdparty.io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:76)
        at org.apache.hadoop.hbase.util.NettyEventLoopGroupConfig.<init>(NettyEventLoopGroupConfig.java:58)
        at org.apache.hadoop.hbase.regionserver.HRegionServer.setupNetty(HRegionServer.java:713)
        at org.apache.hadoop.hbase.regionserver.HRegionServer.<init>(HRegionServer.java:569)
        at org.apache.hadoop.hbase.master.HMaster.<init>(HMaster.java:524)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at org.apache.hadoop.hbase.master.HMaster.constructMaster(HMaster.java:3054)
        at org.apache.hadoop.hbase.master.HMasterCommandLine.startMaster(HMasterCommandLine.java:236)
        at org.apache.hadoop.hbase.master.HMasterCommandLine.run(HMasterCommandLine.java:140)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
        at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:149)
        at org.apache.hadoop.hbase.master.HMaster.main(HMaster.java:3072)
{noformat}

We should try to make this new API accessible to netty for future compatibility.