RockteMQ-AI commented on issue #10612: URL: https://github.com/apache/rocketmq/issues/10612#issuecomment-4951471488
## 🤖 AI Bot Analysis **Issue Type:** Bug (confirmed) **Component:** Controller / Distribution startup scripts **Severity:** Medium — affects all JDK 9+ users starting mqcontroller ### Root Cause `ReplicasInfoManager` declares a static `SerializerFactory` (Hessian) field. During class loading, Hessian's `SerializerFactory.<clinit>` registers `StackTraceElementDeserializer`, which uses `Field.setAccessible(true)` on private fields of `java.lang.StackTraceElement` (e.g. `classLoaderName`, `moduleName`). JDK 9+ module system (JPMS) blocks this reflective access by default, causing `InaccessibleObjectException` at startup. ### Proposed Fix Add `--add-opens java.base/<package>=ALL-UNNAMED` JVM flags for JDK >= 9 in the startup scripts: | File | Change | |---|---| | `distribution/bin/runserver.sh` | Add 10 `--add-opens` flags in `choose_gc_options()` JDK >= 9 branch (covers `mqcontroller`) | | `distribution/bin/runbroker.sh` | Same flags in `choose_gc_options()` JDK >= 9 branch | | `distribution/bin/tools.sh` | Add JDK version detection + same flags | Packages opened: `java.lang`, `java.lang.reflect`, `java.io`, `java.math`, `java.net`, `java.nio`, `java.text`, `java.time`, `java.util`, `java.util.concurrent` ### Workaround (for now) Add the following to your JVM startup options: ``` --add-opens java.base/java.lang=ALL-UNNAMED ``` --- _This issue has been verified against the codebase. A PR with the fix is being prepared._ _Maintainers: reply `/approve` to proceed with the PR, `/revise` to request changes, or `/reject` to skip._ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
