2 Replies Latest reply on Oct 31, 2013 11:59 AM by Aaron Phethean

    jBoss EAP 6.1.Final Playing with HTTP Headers and causing NullPointerException

    Sheeraz Junejo Newbie

      I am porting my RESTful service from jBoss EAP 5.X to jBoss EAP 6.1 which uses Wink. It works absolutely perfectly on jBoss EAP 5.1

       

      Initially when I deployed my service in jBoss EAP 6.1.Final I got exception as 'More than one JAX-RS implementation found POST_....', I searched and found a post which says I have to disable the jBoss ReastEay scanner to over come the problem so I have added following in my web.xml;

       

      <context-param>
        <param-name>resteasy.scan</param-name>
        <param-value>false</param-value>
        </context-param>
        <context-param>
        <param-name>resteasy.scan.providers</param-name>
        <param-value>false</param-value>
        </context-param>
        <context-param>
        <param-name>resteasy.scan.resources</param-name>
        <param-value>false</param-value>
        </context-param>
      

       

      And my previous error gone but I still get an WARN upon server startup which I am not sure if related (but its pasted below just in case)

       

      16:52:44,629 WARN  [org.jboss.as.ee] (MSC service thread 1-3) JBAS011006: Not installing optional component org.apache.cxf.transport.http.Servlet3Cont
      inuationProvider$Servlet3Continuation due to exception: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011054: Could not find d
      efault constructor for class org.apache.cxf.transport.http.Servlet3ContinuationProvider$Servlet3Continuation
              at org.jboss.as.ee.component.ComponentDescription$DefaultComponentConfigurator.configure(ComponentDescription.java:607) [jboss-as-ee-7.2.0.Fin
      al-redhat-8.jar:7.2.0.Final-redhat-8]
              at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:80) [jboss-as-ee-7.2.0.Final-
      redhat-8.jar:7.2.0.Final-redhat-8]
              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0]
              at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]
      

       

      Now when I am trying to access my service URL via POSTMan (Simple Rest Client) I get following exception;

       

      16:52:49,366 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
      16:52:49,367 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss EAP 6.1.0.GA (AS 7.2.0.Final-redhat-8) started in 19146ms - Started 397 o
      f 481 services (83 services are passive or on-demand)
      16:52:50,987 INFO  [org.apache.wink.server.internal.RequestProcessor] (http-/127.0.0.1:8080-1) The following error occurred during the invocation of t
      he handlers chain: NullPointerException with message 'null' while processing GET request sent to http://127.0.0.1:8080/hothouse-iris/Hothouse.svc/
      16:52:50,989 ERROR [org.apache.wink.server.internal.RequestProcessor] (http-/127.0.0.1:8080-1) An unhandled exception occurred which will be propagate
      d to the container.: java.lang.NullPointerException
              at org.apache.wink.common.internal.http.Accept.valueOf(Accept.java:139) [wink-common-1.3.0.jar:1.3.0]
              at org.apache.wink.server.internal.contexts.HttpHeadersImpl.getAcceptHeader(HttpHeadersImpl.java:152) [wink-server-1.2.0-incubating.jar:1.2.0-
      incubating]
              at org.apache.wink.server.internal.contexts.HttpHeadersImpl.getAcceptableMediaTypes(HttpHeadersImpl.java:106) [wink-server-1.2.0-incubating.ja
      r:1.2.0-incubating]
              at org.apache.wink.server.internal.registry.ResourceRegistry.filterByProduces(ResourceRegistry.java:558) [wink-server-1.2.0-incubating.jar:1.2
      .0-incubating]
              at org.apache.wink.server.internal.registry.ResourceRegistry.filterDispatchMethods(ResourceRegistry.java:482) [wink-server-1.2.0-incubating.ja
      r:1.2.0-incubating]
              at org.apache.wink.server.internal.registry.ResourceRegistry.findMethod(ResourceRegistry.java:359) [wink-server-1.2.0-incubating.jar:1.2.0-inc
      ubating]
              at org.apache.wink.server.internal.handlers.FindResourceMethodHandler.handleResourceMethod(FindResourceMethodHandler.java:138) [wink-server-1.
      2.0-incubating.jar:1.2.0-incubating]
              at org.apache.wink.server.internal.handlers.FindResourceMethodHandler.handleRequest(FindResourceMethodHandler.java:65) [wink-server-1.2.0-incu
      bating.jar:1.2.0-incubating]
              at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26) [wink-server-1.2.0-incubating.jar:1.2.0-incubatin
      g]
              at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22) [wink-server-1.2.0-incubating.jar:1.2.0-incubatin
      g]
              at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63) [wink-server-1.2.0-incubating.jar:1.2.0-incuba
      ting]
              at org.apache.wink.server.internal.handlers.FindRootResourceHandler.handleRequest(FindRootResourceHandler.java:95) [wink-server-1.2.0-incubati
      ng.jar:1.2.0-incubating]
              at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26) [wink-server-1.2.0-incubating.jar:1.2.0-incubatin
      g]
              at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22) [wink-server-1.2.0-incubating.jar:1.2.0-incubatin
      g]
              at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63) [wink-server-1.2.0-incubating.jar:1.2.0-incuba
      ting]
      

       

      I used TCPMon to capture my request from client it seems to have all the necessary header information as follows;

       

       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 have tried to enable the HTTP Access Logs as follows;

       

      <subsystem xmlns="urn:jboss:domain:web:1.4" default-virtual-server="default-host" native="false">
                  <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
                  <virtual-server name="default-host" enable-welcome-root="true">
                      <alias name="localhost"/>
                      <alias name="example.com"/>
        <access-log pattern="%h %l %u %t %r %s %b %{User-Agent}i %{JSESSIONID}c">
        <directory relative-to="jboss.server.log.dir" />  
                      </access-log>  
                  </virtual-server>
              </subsystem>
      

       

      But its not printing the HTTP Headers received by the server and what are being passed to the service.

       

      Could you please help me solve this issue. Thanks