3

I am deploying my RESTful web application on jBoss EAP 6.1 (7.2.1Final) with Wink 1.2 and getting following exception on all the request;

     <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)

The same application works OK on previous versions of jBoss like EAP 5.1 and old.

I have also captured the posted request using tcpmon and getting following information in headers;

    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)

I am using Chrome extension POSTMan to request my service and it works.

SJunejo
  • 1,316
  • 4
  • 23
  • 39
  • Just to add one more thing that by default my RESTful deployment failed on jBoss 7 by stating that I can not have more then one JAX-RS Implementation in my .war. So I added few in my web.xml to disable jBoss RestEasy scanner and deployment worked fine but getting above error. – SJunejo Oct 18 '13 at 08:19

4 Answers4

4

The problem was that JAX-RS implementation provided by jboss 7 was conflicting with Apache Wink, we had to disable jboss impl completely by commenting the contents of module.xml under JBOSS_HOME\modules\system\layers\base\javax\ws\rs\api\main to stop loading the Jboss JAX-RS API and it worked fine

SJunejo
  • 1,316
  • 4
  • 23
  • 39
  • I can't to that with my server, If I did it my server stops from working. – Rodmar Conde Jan 04 '16 at 18:29
  • No problem that was just one way...you can leave the above entry as is and use jboss-deployment-structure.xml to exclude the same module from your deployment alone and everything should be fine. – SJunejo Jan 06 '16 at 09:17
4

The problem is that initialization of Accept class does not actually happen, and the delegate field is null.

The RuntimeDelegate is an interface whose implementation should be specified in META-INF/service/javax.ws.rs.ext.RuntimeDelegate file which is searched on the class path.

wink-common.jar contains such a service file with the correct class name of the implementation but if some other service file with the same name is found on class path (on of the jars) before the correct one, we will have such a weird behavior.

Vasile Rotaru
  • 452
  • 4
  • 11
2

This error is caused by the jar file conflict.I deleted jetty.jar,jetty-util.jar and also deleted jsr305.jar,the REST API just work fine.

cidisk
  • 21
  • 3
  • Thanks for the response. I didn't had any jetty jars but had jsr311-api-1.1.1.jar. I removed that but still the same :( – SJunejo Oct 23 '13 at 22:00
1

On WAS8.5 liberty profile, even after I removed the wink dependency causing the error, the error would not go away. It finally turned out that I needed to stop & start my server. The solution was posted at the very bottom of this link https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014940544

asokan
  • 313
  • 5
  • 11