【问题标题】:OSGi bundle with javax.json.JsonException for MoXy用于 MoXy 的带有 javax.json.JsonException 的 OSGi 包
【发布时间】:2017-02-07 09:43:20
【问题描述】:

我应该为 RS 服务的 javax.json 包安装什么 OSGi 包?

我有一个错误:

Caused by: java.lang.NoClassDefFoundError: javax/json/JsonException
    at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.getNewXMLReader(SAXUnmarshaller.java:209)
    at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.getXMLReader(SAXUnmarshaller.java:197)
    at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:452)
    at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:400)
    at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:741)
    at org.eclipse.persistence.internal.oxm.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:649)
    at org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:349)
    at org.eclipse.persistence.jaxb.rs.MOXyJsonProvider.readFrom(MOXyJsonProvider.java:668)

我安装的 JSON 包:

JSR 353 (JSON Processing) Default Providerorg.glassfish.javax.json
Symbolic Name   org.glassfish.javax.json
Version 1.0.4
Bundle Location initial@reference:file:plugins/org.glassfish.javax.json_1.0.4.jar

MOXy 捆绑包:

EclipseLink MOXyorg.eclipse.persistence.moxy
Symbolic Name   org.eclipse.persistence.moxy
Version 2.6.4.v20160829-44060b6
Bundle Location initial@reference:file:plugins/org.eclipse.persistence.moxy_2.6.4.v20160829-44060b6.jar

带进口:

javax.json;分辨率:=可选

看起来一切正常,但事实并非如此。 MoXy 没有得到 javax.json 依赖项。怎么了?错误版本的捆绑包?装载顺序错误?我需要做什么才能让他们上班?

【问题讨论】:

    标签: java json osgi moxy


    【解决方案1】:

    Equinox 如何解析可选包导入似乎是一个普遍问题。

    MoXy 包在 JSon 包之前加载,因此 javax.json 包当时不可用。因为引用是可选的,所以它被“解析”为“未提供”,Equinox 在导入 json 包后没有重新解析它们。

    解决办法:

    1) 影响安装顺序。

    2) 将 Moxy 的启动级别设置为高于 JSon 的值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-12
      • 1970-01-01
      • 1970-01-01
      • 2016-07-20
      • 2017-12-14
      • 1970-01-01
      • 2012-09-26
      • 1970-01-01
      相关资源
      最近更新 更多