You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用JDK17与eclipselink-2.7.14创建SessionBroker时触发空指针异常

问题解决:JDK17 + EclipseLink2.7.14创建SessionBroker时的NullPointerException

根本原因

EclipseLink 2.7.x系列版本不支持JDK17,其内部的JavaSEPlatform类未实现对JDK17及更高版本的版本检测逻辑,导致JavaSEPlatform.CURRENT字段初始化失败,进而触发后续的空指针异常。

解决方案

  • 升级EclipseLink版本:将EclipseLink升级到3.0.0及以上版本,该系列开始全面支持JDK17及后续版本。
  • 降级JDK版本:如果无法升级框架,可将JDK版本降级至11及以下(EclipseLink2.7.x最高支持JDK11)。

错误日志回顾

java.lang.ExceptionInInitializerError
    at org.eclipse.persistence.internal.helper.ClassConstants.<clinit>(ClassConstants.java:64)
    at org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.getDefaultIdentityMapClass(AbstractIdentityMap.java:339)
    at org.eclipse.persistence.sessions.Project.<init>(Project.java:109)
    at org.eclipse.persistence.sessions.Project.<init>(Project.java:198)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.<init>(DatabaseSessionImpl.java:328)
    at org.eclipse.persistence.sessions.broker.SessionBroker.<init>(SessionBroker.java:59)
Caused by: java.lang.NullPointerException: Cannot invoke "org.eclipse.persistence.internal.helper.JavaSEPlatform.atLeast(org.eclipse.persistence.internal.helper.JavaSEPlatform)" because "org.eclipse.persistence.internal.helper.JavaSEPlatform.CURRENT" is null
    at org.eclipse.persistence.indirection.IndirectCollectionsFactory.getProvider(IndirectCollectionsFactory.java:202)
    at org.eclipse.persistence.indirection.IndirectCollectionsFactory.<clinit>(IndirectCollectionsFactory.java:45)

内容的提问来源于stack exchange,提问作者bunnie

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 22:26:09