GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Not working in 17 JDK · Issue #600 · msgpack/msgpack-java

Not working in 17 JDK #600

New issue
Copy link
New issue
Copy link
Closed
#660
Closed
Not working in 17 JDK#600
#660
Copy link

Description

@AcumenDev
AcumenDev
opened on Oct 5, 2021
Issue body actions

Hello, when i use any unpack* metod ( example messageUnpacker.unpackInt()) i recive error

Unable to make private java.nio.DirectByteBuffer(long,int) accessible: module java.base does not "opens java.nio" to unnamed module @5c30a9b0

Probmlem in org.msgpack.core.buffer.DirectBufferAccess and what does he use java.nio.DirectByteBuffer which is closed

Fast decision by add this when you start the JVM : --add-opens java.base/java.nio=ALL-UNNAMED
but it's a crutch(

I use:

'org.msgpack:msgpack-core:0.9.0'

java -version
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment (build 17+35-Ubuntu-120.04)
OpenJDK 64-Bit Server VM (build 17+35-Ubuntu-120.04, mixed mode, sharing)


full stack trace

2021-10-05 16:17:13.717  WARN 36305 --- [ntLoopGroup-3-1] io.netty.channel.DefaultChannelPipeline  : An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.

java.lang.ExceptionInInitializerError: null
	at org.msgpack.core.buffer.MessageBuffer.<init>(MessageBuffer.java:389) ~[msgpack-core-0.9.0.jar:0.9.0]
	at org.msgpack.core.buffer.MessageBuffer.newMessageBuffer(MessageBuffer.java:305) ~[msgpack-core-0.9.0.jar:0.9.0]
	at org.msgpack.core.buffer.MessageBuffer.wrap(MessageBuffer.java:275) ~[msgpack-core-0.9.0.jar:0.9.0]
	at org.msgpack.core.buffer.ByteBufferInput.next(ByteBufferInput.java:57) ~[msgpack-core-0.9.0.jar:0.9.0]
	at org.msgpack.core.MessageUnpacker.getNextBuffer(MessageUnpacker.java:273) ~[msgpack-core-0.9.0.jar:0.9.0]
	at org.msgpack.core.MessageUnpacker.nextBuffer(MessageUnpacker.java:285) ~[msgpack-core-0.9.0.jar:0.9.0]
	at org.msgpack.core.MessageUnpacker.readByte(MessageUnpacker.java:413) ~[msgpack-core-0.9.0.jar:0.9.0]
	at org.msgpack.core.MessageUnpacker.unpackInt(MessageUnpacker.java:939) ~[msgpack-core-0.9.0.jar:0.9.0]
	at com.acumendev.gribcontrol.protocol.msgpack.netty.MsgPackDecoder.findStartPacket(MsgPackDecoder.java:69) ~[main/:na]
	at com.acumendev.gribcontrol.protocol.msgpack.netty.MsgPackDecoder.decode(MsgPackDecoder.java:38) ~[main/:na]
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:507) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:446) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1372) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1235) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1284) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:507) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:446) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:280) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
	at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
Caused by: java.lang.RuntimeException: java.lang.reflect.InaccessibleObjectException: Unable to make private java.nio.DirectByteBuffer(long,int) accessible: module java.base does not "opens java.nio" to unnamed module @5c30a9b0
	at org.msgpack.core.buffer.DirectBufferAccess.<clinit>(DirectBufferAccess.java:111) ~[msgpack-core-0.9.0.jar:0.9.0]
	... 42 common frames omitted
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make private java.nio.DirectByteBuffer(long,int) accessible: module java.base does not "opens java.nio" to unnamed module @5c30a9b0
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) ~[na:na]
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[na:na]
	at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:188) ~[na:na]
	at java.base/java.lang.reflect.Constructor.setAccessible(Constructor.java:181) ~[na:na]
	at org.msgpack.core.buffer.DirectBufferAccess.<clinit>(DirectBufferAccess.java:98) ~[msgpack-core-0.9.0.jar:0.9.0]
	... 42 common frames omitted

`

Reacted by Nikita Sheremet
Reacted by Vladimir

Activity

  1. xerial commented on Jun 28, 2022

    @xerial
    xerial
    on Jun 28, 2022
    Member
    More actions

    The cause is that creating a new DirectBuffer requires a different implementation for JDK17:

    Caused by: java.lang.RuntimeException: java.lang.reflect.InaccessibleObjectException: Unable to make private java.nio.DirectByteBuffer(long,int) accessible: module java.base does not "opens java.nio" to unnamed module @1c3d5e76
    	at org.msgpack.core.buffer.DirectBufferAccess.<clinit>(DirectBufferAccess.java:111)
    	... 10 more
    
  2. xerial
    added a commit that references this issue on Jun 28, 2022

    Reproduce #600 (JDk17 error)

    65188ed
  3. xerial
    closed this as completedin #660on Jun 28, 2022
  4. xerial
    added a commit that references this issue on Jun 28, 2022

    Support JDK17 (#660)

    117f161
  5. xerial commented on Jun 28, 2022

    @xerial
    xerial
    on Jun 28, 2022
    Member
    More actions

    To use DirectByteBuffer in JDK17, two JVM options must be set:

    --add-opens=java.base/java.nio=ALL-UNNAMED
    --add-opens=java.base/sun.nio.ch=ALL-UNNAMED
    

    If DirectByteBuffer is not used, msgpack-java 0.9.3 will work even if these two options are not set.

    Reacted by Bruce Wen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.