apache / apache/rocketmq

[Bug] Does not support JDK 17

Open
#10,170 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
22.6k
Forks
12k
Avg merge
2d 20h
Merged PRs (30d)
26

Description

### Before Creating the Bug Report

- [x] I found a bug, not just asking a question, which should be created in [GitHub Discussions](https://github.com/apache/rocketmq/discussions).

- [x] I have searched the [GitHub Issues](https://github.com/apache/rocketmq/issues) and [GitHub Discussions](https://github.com/apache/rocketmq/discussions) of this repository and believe that this is not a duplicate.

- [x] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

### Runtime platform environment

linux服务器, jdk17或者之后的版本

### RocketMQ version

version: release-5.4.0

### JDK Version

jdk17

### Describe the Bug

jdk17之后启动失败, 能排查一下rocketmq的包依赖吗?

maven排查命令: mvn dependency:tree -Dincludes=com.alipay.sofa:hessian

不然每次都要改--add-opens java.base/java.lang=ALL-UNNAMED这种命令行.

Image

### Steps to Reproduce

nohup bash $ROCKETMQ_HOME/bin/mqnamesrv -c $ROCKETMQ_HOME/conf/controller/cluster-3n-namesrv-plugin/namesrv-n0.conf &

```properties
#Namesrv config
listenPort = 9876
enableControllerInNamesrv = true

#controller config
controllerDLegerGroup = group1
controllerDLegerPeers = n0-10.0.0.101:9876;n1-10.0.0.102:9876;n2-10.0.0.103:9876
controllerDLegerSelfId = n0
```
### What Did You Expect to See?

Successful startup

### What Did You See Instead?

```text
The Name Server boot success. serializeType=JSON, address 0.0.0.0:9876
java.lang.reflect.InaccessibleObjectException: Unable to make field private java.lang.String java.lang.StackTraceElement.classLoaderName accessible: module java.base does not "opens java.lang" to unnamed module @571613d2
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 com.caucho.hessian.io.JavaDeserializer.getFieldMap(JavaDeserializer.java:329)
at com.caucho.hessian.io.JavaDeserializer.(JavaDeserializer.java:97)
at com.caucho.hessian.io.StackTraceElementDeserializer.(StackTraceElementDeserializer.java:57)
at com.caucho.hessian.io.SerializerFactory.(SerializerFactory.java:589)
at org.apache.rocketmq.controller.impl.manager.ReplicasInfoManager.(ReplicasInfoManager.java:79)
at org.apache.rocketmq.controller.impl.DLedgerController.(DLedgerController.java:132)
at org.apache.rocketmq.controller.ControllerManager.initialize(ControllerManager.java:122)
at org.apache.rocketmq.namesrv.NamesrvStartup.start(NamesrvStartup.java:205)
at org.apache.rocketmq.namesrv.NamesrvStartup.createAndStartControllerManager(NamesrvStartup.java:184)
at org.apache.rocketmq.namesrv.NamesrvStartup.controllerManagerMain(NamesrvStartup.java:75)
at org.apache.rocketmq.namesrv.NamesrvStartup.main(NamesrvStartup.java:56)
```

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Research direction

Inspect the Maven dependency tree for com.alipay.sofa:hessian and the startup path through NamesrvStartup, ControllerManager, DLedgerController, and ReplicasInfoManager. Reproduce the controller-enabled nameserver launch on JDK 17 without --add-opens, then verify successful startup without InaccessibleObjectException; the issue does not identify a target file or preferred dependency change.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.