Caused by: java.lang.ExceptionInInitializerError:
Exception java.lang.reflect.InaccessibleObjectException:
Unable to make field long java.nio.Buffer.address accessible:
module java.base does not "opens java.nio" to unnamed module @6bf256fa

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>untitled1</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- 添加 Netty 版本属性 -->
<netty.version>4.1.77.Final</netty.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>4.5.1</version>
<!-- 排除旧版 Netty -->
<exclusions>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 添加兼容 JDK 17 的 Netty 版本 -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>${netty.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<mainClass>org.example.ConsumerExample</mainClass>
<arguments>
<argument>arg1</argument> <!-- 如果有命令行参数 -->
</arguments>
<!-- 添加 JVM 参数解决访问问题 -->
<jvmArgs>
<jvmArg>--add-opens</jvmArg>
<jvmArg>java.base/java.nio=ALL-UNNAMED</jvmArg>
<jvmArg>--add-opens</jvmArg>
<jvmArg>java.base/sun.nio.ch=ALL-UNNAMED</jvmArg>
</jvmArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>