我正在使用Wink 1.2在jBoss EAP 6.1(7.2.1Final)上部署RESTful Web應用程序,並在所有請求中獲得以下異常;Apache Wink Accept()失敗,返回NullPointerException
<b>JBWEB000070: exception</b>
<pre>java.lang.NullPointerException
org.apache.wink.common.internal.http.Accept.valueOf(Accept.java:139)
org.apache.wink.server.internal.contexts.HttpHeadersImpl.getAcceptHeader(HttpHeadersImpl.java:152)
org.apache.wink.server.internal.contexts.HttpHeadersImpl.getAcceptableMediaTypes(HttpHeadersImpl.java:106)
org.apache.wink.server.internal.registry.ResourceRegistry.filterByProduces(ResourceRegistry.java:558)
org.apache.wink.server.internal.registry.ResourceRegistry.filterDispatchMethods(ResourceRegistry.java:482)
org.apache.wink.server.internal.registry.ResourceRegistry.findMethod(ResourceRegistry.java:359)
org.apache.wink.server.internal.handlers.FindResourceMethodHandler.handleResourceMethod(FindResourceMethodHandler.java:138)
org.apache.wink.server.internal.handlers.FindResourceMethodHandler.handleRequest(FindResourceMethodHandler.java:65)
org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63)
org.apache.wink.server.internal.handlers.FindRootResourceHandler.handleRequest(FindRootResourceHandler.java:95)
org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63)
同一應用程序的工作原理像EAP 5.1和舊的JBoss以前的版本確定。
我也使用tcpmon捕獲發佈的請求,並獲取標題中的以下信息;
GET /hothouse-iris/Hothouse.svc/ HTTP/1.1
Host: 127.0.0.1:9090
Connection: keep-alive
Authorization: Basic U1NPVVNFUjE6MTIzNDU2
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36
Content-Type: application/atom+xml
Accept: */*
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
Cookie: JSESSIONID=8D9FE5379FE7576610BB4B78A431AD10; __utma=96992031.2145502422.1381922298.1382004674.1382006170.4; __utmc=96992031; __utmz=96992031.1381922298.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
我使用Chrome擴展POSTMan來請求我的服務,它的工作原理。
只需添加一件事,即默認情況下,我的RESTful部署在jBoss 7上失敗,說明我的.war中不能有多個JAX-RS實現。所以我在我的web.xml中添加了一些來禁用jBoss RestEasy掃描器,並且部署工作正常,但出現錯誤。 –
SJunejo