泽西岛 2.27、spring 5.0.7.RELEASE 和 Java 10 合规性问题

Jersey 2.27, spring 5.0.7.RELEASE and Java 10 compliance issue

我认为我有合规性问题。我收到此异常:

org.glassfish.jersey.server.ContainerException: java.lang.ExceptionInInitializerError] with root cause java.lang.NullPointerException
at org.eclipse.persistence.indirection.IndirectCollectionsFactory.getProvider(IndirectCollectionsFactory.java:202)
at org.eclipse.persistence.indirection.IndirectCollectionsFactory.<clinit>(IndirectCollectionsFactory.java:45)
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.jaxb.compiler.MappingsGenerator.generateProject(MappingsGenerator.java:230)
at org.eclipse.persistence.jaxb.compiler.Generator.generateProject(Generator.java:186)
at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:1140)
at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:1132)
at org.eclipse.persistence.jaxb.JAXBContext.<init>(JAXBContext.java:193)
at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:165)
at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:152)
at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:112)
at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:102)
at org.eclipse.persistence.jaxb.rs.MOXyJsonProvider.getJAXBContext(MOXyJsonProvider.java:325)
at org.eclipse.persistence.jaxb.rs.MOXyJsonProvider.getJAXBContext(MOXyJsonProvider.java:345)
at org.eclipse.persistence.jaxb.rs.MOXyJsonProvider.isReadable(MOXyJsonProvider.java:470)
at org.glassfish.jersey.moxy.json.internal.ConfigurableMoxyJsonProvider.isReadable(ConfigurableMoxyJsonProvider.java:189)

空指针在这里:

//try this on JDK 8+ only (see bug 464096)
if (!useJ2SE7IndirectCollections && JavaSEPlatform.CURRENT.atLeast(JavaSEPlatform.v1_8)) {

因为 JavaSEPlatform.CURRENT 为空 Java 10(见下面的枚举):

/** Java SE 1.1. */
v1_1(1,1),
/** Java SE 1.2. */
v1_2(1,2),
/** Java SE 1.3. */
v1_3(1,3),
/** Java SE 1.4. */
v1_4(1,4),
/** Java SE 1.5. */
v1_5(1,5),
/** Java SE 1.6. */
v1_6(1,6),
/** Java SE 1.7. */
v1_7(1,7),
/** Java SE 1.8. */
v1_8(1,8),
/** Java SE 9. */
v1_9(1,9),
/** Java SE 9. */
v9_0(9, 0);

有人可以确认这是一个错误吗?我无法报告错误,因为此 https://github.com/jersey/jersey/issues 是只读的。 我可以应用什么修复程序(降级到 java 9 除外)?

感谢回复。

编辑 Jersey 版本是 2.27,不是我第一次写的 2.17

按照回购协议中的建议,我使用以下依赖项更新了 pom.xml 文件:

<dependencies>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-moxy</artifactId>
        <version>${jersey-version}</version>
        <exclusions>
            <!-- Not Java 10 compliant -->
            <exclusion>
                <groupId>org.eclipse.persistence</groupId>
                <artifactId>org.eclipse.persistence.moxy</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>org.eclipse.persistence.moxy</artifactId>
        <version>2.7.2</version>
    </dependency>
</dependencies>

npe 消失了