You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Abhijit Sarkar <ab...@gmail.com> on 2014/02/09 19:23:59 UTC

CDI injection target is always null in my JAX-RS resource

Hi,
My problem is that the CDI injection target is always null in my JAX-RS
resource. There's zero documentation on combining JAX-RS and CDI in a
Servlet container and the only remotely useful discussion found online is 4
years old. At the end, I moved to using RESTEasy where at least one person
had got it working...make that two, including me now. However, it still
bothers me that I couldn't get CXF working and hence this question.

My working code can be found on GitHub, here's the link to the resource in
question:
https://github.com/abhijitsarkar/groovy/blob/master/movie-manager/movie-manager-web/src/main/groovy/name/abhijitsarkar/moviemanager/web/MovieResource.groovy

Language: Groovy 2.2.1
CDI Spec: 1.1
CDI Implementation: Weld servlet 2.1.2.Final
JAX_RS spec: 2.0
JAX-RS Implementation: CXF 3.0.0-milestone1
Container: Embedded Jetty 9.1.1.v20140108
Build tool: Gradle 1.10

Regards,
Abhijit Sarkar

Re: CDI injection target is always null in my JAX-RS resource

Posted by Abhijit Sarkar <ab...@gmail.com>.
Given the industry impetus to ditch the big a*s servers when more and more
people simply don't need all the bells and whistles, I'm little surprised
it's not a hotly debated issue yet. It might make sense having a "bridge"
which delegates to the appropriate engine if a class is annotated as both a
CDI bean and a JAX-RS resource. CDI should always get a chance first to
instantiate and if for some reason it can't, JAX-RS can kick in.
I don't know the internals of CXF much but if I may be of any help, I'll be
glad to do so. I've no problems with JAX-RS knowledge but stayed with the
RI most of the time.

Regards,
Abhijit


On Sun, Feb 9, 2014 at 1:36 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi
> On 09/02/14 18:23, Abhijit Sarkar wrote:
>
>> Hi,
>> My problem is that the CDI injection target is always null in my JAX-RS
>> resource. There's zero documentation on combining JAX-RS and CDI in a
>> Servlet container and the only remotely useful discussion found online is
>> 4
>> years old. At the end, I moved to using RESTEasy where at least one person
>> had got it working...make that two, including me now. However, it still
>> bothers me that I couldn't get CXF working and hence this question.
>>
>> My working code can be found on GitHub, here's the link to the resource in
>> question:
>> https://github.com/abhijitsarkar/groovy/blob/master/movie-manager/movie-
>> manager-web/src/main/groovy/name/abhijitsarkar/moviemanager/web/
>> MovieResource.groovy
>>
>> Language: Groovy 2.2.1
>> CDI Spec: 1.1
>> CDI Implementation: Weld servlet 2.1.2.Final
>> JAX_RS spec: 2.0
>> JAX-RS Implementation: CXF 3.0.0-milestone1
>> Container: Embedded Jetty 9.1.1.v20140108
>> Build tool: Gradle 1.10
>>
>>
> It's never worked independently AFAIK, TomEE+ should support though,
>
> That said, I know we have people interested in providing the closer
> integration with CDI (not only for JAX-RS), Christian, Andriy Redko, others
> may have the ideas on what can be done
>
> Thanks, Sergey
>
>  Regards,
>> Abhijit Sarkar
>>
>>
>

Re: CDI injection target is always null in my JAX-RS resource

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 09/02/14 18:23, Abhijit Sarkar wrote:
> Hi,
> My problem is that the CDI injection target is always null in my JAX-RS
> resource. There's zero documentation on combining JAX-RS and CDI in a
> Servlet container and the only remotely useful discussion found online is 4
> years old. At the end, I moved to using RESTEasy where at least one person
> had got it working...make that two, including me now. However, it still
> bothers me that I couldn't get CXF working and hence this question.
>
> My working code can be found on GitHub, here's the link to the resource in
> question:
> https://github.com/abhijitsarkar/groovy/blob/master/movie-manager/movie-manager-web/src/main/groovy/name/abhijitsarkar/moviemanager/web/MovieResource.groovy
>
> Language: Groovy 2.2.1
> CDI Spec: 1.1
> CDI Implementation: Weld servlet 2.1.2.Final
> JAX_RS spec: 2.0
> JAX-RS Implementation: CXF 3.0.0-milestone1
> Container: Embedded Jetty 9.1.1.v20140108
> Build tool: Gradle 1.10
>

It's never worked independently AFAIK, TomEE+ should support though,

That said, I know we have people interested in providing the closer 
integration with CDI (not only for JAX-RS), Christian, Andriy Redko, 
others may have the ideas on what can be done

Thanks, Sergey

> Regards,
> Abhijit Sarkar
>