[ https://issues.apache.org/jira/browse/GEODE-9474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17522983#comment-17522983 ]
Darrel Schneider edited comment on GEODE-9474 at 4/19/22 11:25 PM: ------------------------------------------------------------------- For Java17 we need the server to have "java.nio" opened for offheap to work. I think we should just add this to the list of opens needed by geode features. was (Author: dschneider): For Java17 we need to server to have "java.nio" opened for offheap to work. I think we should just add this to the list of opens needed by geode features. > the Geode offheap feature will fail on java 16 > ---------------------------------------------- > > Key: GEODE-9474 > URL: https://issues.apache.org/jira/browse/GEODE-9474 > Project: Geode > Issue Type: Bug > Components: offheap > Reporter: Darrel Schneider > Priority: Major > Labels: Java16, Java17 > > In two different places geode offheap calls setAccessible. In one place it is > to call the "address" method. In the other it is to call the DIrectByteBuffer > constructor that passes an address in to the constructor. These will not work > on java 16 and later because it calls Method.setAccessible which is not > allowed under normal conditions starting with java 16 (see: > https://softwaregarden.dev/en/posts/new-java/illegal-access-in-java-16 ). > To workaround this failure set the JVM command line option: > --illegal-access=permit or use --add-opens. > The places that make the calls: > * > org.apache.geode.internal.offheap.AddressableMemoryManager#getDirectByteBufferAddress > * > org.apache.geode.internal.offheap.AddressableMemoryManager#createDirectByteBuffer > The "address" call does not need to use reflection and setAccessible but can > instead do it with casting. See > org.apache.geode.unsafe.internal.sun.nio.ch.DirectBuffer for how this is done. > The constructor issue is a bigger problem. This constructor can be called > from JNI NewDirectByteBuffer but needing to add native code to geode does not > seem worth the trouble. If some other solution can not be found then the > above workaround would need to be used if offheap is. -- This message was sent by Atlassian Jira (v8.20.7#820007)