这是我的gradle文件:
compile group: 'io.dropwizard', name: 'dropwizard-core', version: '0.8.0'
compile group: 'io.dropwizard', name: 'dropwizard-auth', version: '0.8.0'
compile group: 'io.dropwizard', name: 'dropwizard-client', version: '0.8.0'
compile group: 'org.glassfish.jersey.media', name: 'jersey-media-multipart', version: '2.16'
compile group: 'org.glassfish.jersey.core', name: 'jersey-client', version: '2.16'
compile group: 'org.atmosphere', name: 'atmosphere-jersey', version: '2.1.10'
添加氛围-jursey后,我收到以下错误:
WARN [2015-05-03 21:13:38,796] 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/MessagingException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2532)
at java.lang.Class.getDeclaredConstructors(Class.java:1901)
at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1310)
at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1306)
at java.security.AccessController.doPrivileged(Native Method)...
MultiException stack 2 of 3
java.lang.IllegalStateException: Unable to perform operation: method inject
on com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$App
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:395)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:471)
at org.jvnet.hk2.internal.PerLookupContext.findOrCreate(PerLookupContext.java:69)..
MultiException stack 3 of 3
java.lang.IllegalStateException: Unable to perform operation:
create on org.glassfish.jersey.message.internal.MessageBodyFactory...
org.glassfish.hk2.api.MultiException: A MultiException has
3 exceptions. They are:
! 1. java.lang.NullPointerException
! 2. java.lang.IllegalStateException: Unable to perform operation:
method inject on com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$App
! 3. java.lang.IllegalStateException: Unable to perform operation:
create on org.glassfish.jersey.message.internal.MessageBodyFactory
答案 0 :(得分:0)
从我在atmosphere's pom.xml中可以看到,他们使用的是球衣1.x而dropwizard则使用球衣2.x.而这两个图书馆并不能很好地相处。我相信气氛并没有直接支持球衣2,至少在最新版本中也没有。
所以我猜你不能使用atmosphere-jersey
,但我看到我的同事正在使用atmosphere-runtime
和atmosphere-annotations
使用dropwizard 0.8就好了。