Dropwizard应用程序因AbstractJAXBProvider崩溃 [英] Dropwizard Application crashed by AbstractJAXBProvider

查看:315
本文介绍了Dropwizard应用程序因AbstractJAXBProvider崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 Dropwizard 和Gradle作为构建系统实现的服务器应用程序.现在,我想集成 Apache Mahout 进行一些推荐系统操作.

I have a server application implemented using Dropwizard and Gradle as Build System. Now I want to integrate Apache Mahout for some recommender system action.

添加Mahout依赖项并尝试运行后,出现异常.

After adding the Mahout dependency and try to run, I get exceptions.

我的初始依赖项看起来像

My initial dependencies look like

dependencies {
    compile 'io.dropwizard:dropwizard-core:0.9.1'
    compile 'io.dropwizard:dropwizard-jdbi:0.9.1'
    compile 'mysql:mysql-connector-java:5.1.37'
    compile 'redis.clients:jedis:2.8.0'
    compile 'com.google.guava:guava:18.0'
    compile 'joda-time:joda-time:2.9.1'
    compile 'org.apache.commons:commons-math3:3.4.1'
}

为了完成一些基本的荐荐系统内容,我集成了依赖项

For doing some basic recommender system stuff I integrate the dependency

compile 'org.apache.mahout:mahout-mr:0.11.1'

当我现在运行应用程序时,出现NoClassDefFoundException:

When I now run the application I get a NoClassDefFoundException:

WARN  [2015-12-07 15:03:09,696] org.glassfish.jersey.internal.Errors: 
The following warnings have been detected: WARNING: HK2 service reification 
failed for [com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider] 
with an exception:
MultiException stack 1 of 2
java.lang.NoClassDefFoundError: javax/mail/internet/ParseException

所以我试图通过

compile 'com.sun.mail:javax.mail:1.5.4'

再次运行该应用程序,我得到了另一个异常:

Running again the application, I get a different exception:

WARN  [2015-12-07 15:05:02,161] org.glassfish.jersey.internal.Errors: The 
following warnings have been detected: WARNING: Unknown HK2 failure detected:
MultiException stack 1 of 2
java.lang.NullPointerException at 
com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.setConfiguration(AbstractJAXBProvider.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)

导致异常的代码来自泽西岛:

The Code that causes the exception comes from Jersey:

@Context
public void setConfiguration(FeaturesAndProperties fp) {
    formattedOutput = fp.getFeature(FeaturesAndProperties.FEATURE_FORMATTED); // << Crash here
    xmlRootElementProcessing = fp.getFeature(FeaturesAndProperties.FEATURE_XMLROOTELEMENT_PROCESSING);
}

因此,此处的功能似乎为空,我们无法对其进行任何处理.任何人都知道发生了什么事,或者我该如何处理?

So it seems like the feature is null here and we can't do anything with it. Anyone an idea what's going on, or how I can manage this?

推荐答案

问题是/是Dropwizard附带了Jersey依赖项(以我为例,在2.22.x中为org.glassfish.jersey),而Apache Mahout附带了不同的Jersey依赖项(在我的案例中为1.9中的com.sun.jersey).

The problem was / is that Dropwizard ships with a Jersey dependency (in my case org.glassfish.jersey in 2.22.x), and Apache Mahout ships with a different Jersey dependency (in my case com.sun.jersey in 1.9).

因此,排除Mahout Jersey依赖项可以完成此任务.就我而言,这是通过

So excluding the Mahout Jersey dependency does the job. In my case this is done by

compile('org.apache.mahout:mahout-integration:0.11.1') {
    exclude group: 'com.sun.jersey'
}

这篇关于Dropwizard应用程序因AbstractJAXBProvider崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆