【发布时间】:2017-08-28 16:11:19
【问题描述】:
问题
当我尝试使用GrizzlyHttpServerFactory.createHttpServer 时,我得到一个“WARNING: Unknown HK2 failure detected:”,然后是“MultiException”中的两个错误:
- “
java.lang.NoSuchFieldError: WADL” - “
Unable to perform operation: create on org.glassfish.jersey.server.wadl.processor.WadlModelProcessor”
我试过了
我不熟悉泽西岛,但我有:
- 阅读七个月前的 this similar, unsolved question 和两年前的 this one。
- 获悉 ResourceConfig is meant to replace/simplify a web.xml,但该项目没有现有的(因此没有冲突的)web.xmls。
- 删除了下划线并更改了 URI 中的端口号 (
http://127.0.0.1:8086/the_uri/)。没用。
深入
我正在使用的资源配置:
public class MyResourceConfig extends ResourceConfig {
public MyResourceConfig(){
register(CORSResponseFilter.class);
register(MyAPIPoint.class);
}
}
包含两个正在注册的类,仅此而已。
截断错误堆栈跟踪:
WARNING: The following warnings have been detected: WARNING: Unknown HK2 failure detected:
MultiException stack 1 of 2
java.lang.NoSuchFieldError: WADL
at org.glassfish.jersey.server.wadl.processor.WadlModelProcessor.<init>(WadlModelProcessor.java:96)
...
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.<init>(GrizzlyHttpContainer.java:331)
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory.createHttpServer(GrizzlyHttpServerFactory.java:116)
MultiException stack 2 of 2
java.lang.IllegalStateException: Unable to perform operation: create on org.glassfish.jersey.server.wadl.processor.WadlModelProcessor
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:395)
...
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.<init>(GrizzlyHttpContainer.java:331)
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory.createHttpServer(GrizzlyHttpServerFactory.java:116)
【问题讨论】: