dosubot[bot] commented on issue #2904: URL: https://github.com/apache/incubator-hugegraph/issues/2904#issuecomment-3516354757
<!-- Answer --> 你遇到的启动失败,是因为设置了 `PASSWORD`(开启鉴权模式)和 `PRELOAD`(预加载样例图)后,HugeGraph 会走认证和样例数据初始化的代码路径,这些路径需要访问 JDK 的内部 API(如 `jdk.internal.reflect.Reflection.registerMethodsToFilter`),但 Java 11+ 默认禁止访问这些内部模块,导致 `InaccessibleObjectException` 抛错,容器无法正常启动。[相关源码分析](https://github.com/apache/incubator-hugegraph/blob/a53af864b31f803780a1db31cb20d3d94d5d34fc/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java#L0-L646) 解决方法:在 Docker Compose 的环境变量里加上 JVM 参数,允许访问 JDK 内部 API。具体做法如下: ```yml version: '3' services: server: image: docker.1ms.run/hugegraph/hugegraph:latest container_name: server environment: - PASSWORD=hugegraph@2025 - PRELOAD=true - JAVA_OPTS=--add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED ports: - 58080:8080 ``` 这样 HugeGraph 启动时就能访问需要的 JDK 内部 API,避免报错。如果你用的是生产环境,建议用官方 release tag 镜像(如 `hugegraph/hugegraph:1.5.0`),不要用 `latest`,以保证稳定性。 如果还有其他报错,可以查看 `/hugegraph-server/logs/hugegraph-server.log` 获取详细信息。 <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/b147bd55-26cd-4c71-a5ac-27d3f91de1d5?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/b147bd55-26cd-4c71-a5ac-27d3f91de1d5?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/b147bd55-26cd-4c71-a5ac-27d3f91de1d5?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/b147bd55-26cd-4c71-a5ac-27d3f91de1d5?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b147bd55-26cd-4c71-a5ac-27d3f91de1d5?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/b147bd55-26cd-4c71-a5ac-27d3f91de1d5?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b147bd55-26cd-4c71-a5ac-27d3f91de1d5?feedback_type=other)</sup> [](https://app.dosu.dev/e5e246fa-a522-4d8a-ab3c-e2588b5b501b/ask?utm_source=githu b) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/incubator-hugegraph/issues/2904) -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
