从球衣1.18.1迁移到球衣1.19时的NoClassDefFoundError javax / ws / rs / core / Application

时间:2016-01-07 23:24:26

标签: java rest web-applications jaxb jersey

当我升级版本的球衣时,我在尝试启动我的网络应用程序时遇到上述异常。 我正在使用泽西岛库实施JAXBContextResolver implements ContextResolver<JAXBContext>。 在我看到的例外中:

Caused by: java.lang.NoClassDefFoundError: javax/ws/rs/core/Application.

配置:

<jersey-server.version>1.19</jersey-server.version>
<jersey-core.version>${jersey-server.version}</jersey-core.version>
<jersey-servlet.version>${jersey-server.version}</jersey-servlet.version>
<jersey-json.version>${jersey-server.version}</jersey-json.version>
<jersey-client.version>${jersey-server.version}</jersey-client.version>

代码:

public class JAXBContextResolver implements ContextResolver<JAXBContext> {
private static final Class<?>[] classes = { Customer.class, Model.class,
        User.class, Workspace.class, AuthResponse.class, Category.class,
        CategoryValue.class };
private JAXBContext context;

public JAXBContextResolver() throws Exception {
    context = new JSONJAXBContext(
            JSONConfiguration.natural().humanReadableFormatting(true)
                    .rootUnwrapping(true).build(), classes);
}

public JAXBContext getContext(Class<?> objectType) {
    return context;
  }
}

1 个答案:

答案 0 :(得分:1)

需要添加jsr311-api的依赖关系,然后才能工作。