You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Michael Bannii <Mi...@evry.com> on 2014/07/14 18:01:54 UTC

CXF & NIO & JAX-RS 2

Hi,

This February there was a thread titled "Server Side Asynchronous processing support via CXF & NIO support" regarding an NPE thrown at AsyncResponseImpl.java:240 when trying to use AsyncResponse. I get a simmilar stacktrace, and I prepared an own simple test maven project demonstrating the issue (attached to the email).

In short:
 1. I use latest Jetty: 8.1.15.v20140411.
 2. In web.xml i have both 'version="3.0"' and '<async-supported>true</async-supported>'.
 3. My rest resource api is declared using AsyncResponse.

And still i get this:

java.lang.NullPointerException
    at org.apache.cxf.jaxrs.impl.AsyncResponseImpl.initContinuation(AsyncResponseImpl.java:240)
    at org.apache.cxf.jaxrs.impl.AsyncResponseImpl.<init>(AsyncResponseImpl.java:58)
    at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:775)
    at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:749)
    at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:236)
    at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:101)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
    .......

Am I missing something? Can it be some async setup that is missing in my jaxrs:server declaration inside applicationContext.xml? Currently i have there:

    <jaxrs:server address="/api">
        <jaxrs:properties/>
        <jaxrs:serviceBeans>
            <ref bean="apiResourceBean"/>
        </jaxrs:serviceBeans>
        <jaxrs:providers>
            <ref bean="jacksonProvider"/>
        </jaxrs:providers>
        <jaxrs:features>
            <cxf:logging/>
        </jaxrs:features>
    </jaxrs:server>


--
Best regards
Michael

RE: CXF & NIO & JAX-RS 2

Posted by Michael Bannii <Mi...@evry.com>.
Yes, you are right, thanks, it helped. In my web.xml there was MDCInsertingServletFilter filter declared without "<async-supported>true</async-supported>" and that was the cause.


________________________________________
From: Sergey Beryozkin [sberyozkin@gmail.com]
Sent: Monday, July 14, 2014 7:15 PM
To: users@cxf.apache.org
Subject: Re: CXF & NIO & JAX-RS 2

Hi, will this StackOverflow help:

http://stackoverflow.com/questions/23711409/jetty-9-asyncresponse-not-working

?

Let me know please
Cheers, Sergey
On 14/07/14 17:01, Michael Bannii wrote:
> Hi,
>
> This February there was a thread titled "Server Side Asynchronous
> processing support via CXF & NIO support" regarding an NPE thrown at
> AsyncResponseImpl.java:240 when trying to use AsyncResponse. I get a
> simmilar stacktrace, and I prepared an own simple test maven project
> demonstrating the issue (attached to the email).
>
> In short:
>   1. I use latest Jetty: 8.1.15.v20140411.
>   2. In web.xml i have both 'version="3.0"' and
> '<async-supported>true</async-supported>'.
>   3. My rest resource api is declared using AsyncResponse.
>
> And still i get this:
>
> java.lang.NullPointerException
>      at
> org.apache.cxf.jaxrs.impl.AsyncResponseImpl.initContinuation(AsyncResponseImpl.java:240)
>      at
> org.apache.cxf.jaxrs.impl.AsyncResponseImpl.<init>(AsyncResponseImpl.java:58)
>      at
> org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:775)
>      at
> org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:749)
>      at
> org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:236)
>      at
> org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:101)
>      at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
>      .......
>
> Am I missing something? Can it be some async setup that is missing in my
> jaxrs:server declaration inside applicationContext.xml? Currently i have
> there:
>
>      <jaxrs:server address="/api">
>          <jaxrs:properties/>
>          <jaxrs:serviceBeans>
>              <ref bean="apiResourceBean"/>
>          </jaxrs:serviceBeans>
>          <jaxrs:providers>
>              <ref bean="jacksonProvider"/>
>          </jaxrs:providers>
>          <jaxrs:features>
>              <cxf:logging/>
>          </jaxrs:features>
>      </jaxrs:server>
>
> --
>
> Best regards
>
> Michael
>


--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: CXF & NIO & JAX-RS 2

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi, will this StackOverflow help:

http://stackoverflow.com/questions/23711409/jetty-9-asyncresponse-not-working

?

Let me know please
Cheers, Sergey
On 14/07/14 17:01, Michael Bannii wrote:
> Hi,
>
> This February there was a thread titled "Server Side Asynchronous
> processing support via CXF & NIO support" regarding an NPE thrown at
> AsyncResponseImpl.java:240 when trying to use AsyncResponse. I get a
> simmilar stacktrace, and I prepared an own simple test maven project
> demonstrating the issue (attached to the email).
>
> In short:
>   1. I use latest Jetty: 8.1.15.v20140411.
>   2. In web.xml i have both 'version="3.0"' and
> '<async-supported>true</async-supported>'.
>   3. My rest resource api is declared using AsyncResponse.
>
> And still i get this:
>
> java.lang.NullPointerException
>      at
> org.apache.cxf.jaxrs.impl.AsyncResponseImpl.initContinuation(AsyncResponseImpl.java:240)
>      at
> org.apache.cxf.jaxrs.impl.AsyncResponseImpl.<init>(AsyncResponseImpl.java:58)
>      at
> org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:775)
>      at
> org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:749)
>      at
> org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:236)
>      at
> org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:101)
>      at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
>      .......
>
> Am I missing something? Can it be some async setup that is missing in my
> jaxrs:server declaration inside applicationContext.xml? Currently i have
> there:
>
>      <jaxrs:server address="/api">
>          <jaxrs:properties/>
>          <jaxrs:serviceBeans>
>              <ref bean="apiResourceBean"/>
>          </jaxrs:serviceBeans>
>          <jaxrs:providers>
>              <ref bean="jacksonProvider"/>
>          </jaxrs:providers>
>          <jaxrs:features>
>              <cxf:logging/>
>          </jaxrs:features>
>      </jaxrs:server>
>
> --
>
> Best regards
>
> Michael
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com