Spring Boot 2.7.18集成Apache Ignite 2.16.0启动失败问题求助
解决Spring Boot 2.7.18 + Java 17 升级Ignite 2.16.0 REST API启动失败问题
问题根源
Ignite 2.16.0的JDBC Thin Driver依赖java.nio.Buffer.address这个内部字段,但Java 17的模块系统默认禁止外部类访问该字段,导致org.apache.ignite.IgniteJdbcThinDriver初始化失败,进而触发Spring Bean创建异常,最终启动失败。
修复方案
1. 添加JVM启动参数
直接在应用启动时加上以下参数,开放模块访问权限:--add-opens java.base/java.nio=ALL-UNNAMED
2. Maven插件启动时配置参数
如果用spring-boot:run命令启动,在pom.xml的Spring Boot插件里配置JVM参数:
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <jvmArguments>--add-opens java.base/java.nio=ALL-UNNAMED</jvmArguments> </configuration> </plugin>
3. 确认Ignite依赖配置
确保REST API及相关依赖正确引入:
<dependency> <groupId>org.apache.ignite</groupId> <artifactId>ignite-rest-api</artifactId> <version>2.16.0</version> </dependency> <dependency> <groupId>org.apache.ignite</groupId> <artifactId>ignite-jdbc-thin</artifactId> <version>2.16.0</version> </dependency>
4. 长期解决方案:升级Ignite版本
Ignite 2.17.0及以上版本已经修复了Java 17的兼容性问题,不再依赖Buffer.address字段。如果项目允许,直接升级到更高版本就不用再加额外JVM参数了。
内容的提问来源于stack exchange,提问作者Ganesh Thondepu
相关产品推荐
相关产品推荐

