CDI with Jersey and Tomcat7 - Interceptors are never invoked‏

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

CDI with Jersey and Tomcat7 - Interceptors are never invoked‏

srinannapa
 
 
I'm trying to work CDI interceptors with Jersy abd Tomcat 7. But it never worked. Can some one please help me.

I'm kind of trying the example provided by Jersey with some minor modifications.

Here is my code. Interestingly I can see the message "Injected....." in the output, means @PostConstruct annotation is working.

Please find the attached project.

cdi-webapp.zip
 

I'm referring to the following classes in the attached project:
 
EchoParamFieldResource.java
Logged
LoggedInterceptor
LoggedInterceptorTest
beans.xml
Reply | Threaded
Open this post in threaded view
|

Re: CDI with Jersey and Tomcat7 - Interceptors are never invoked‏

japod
Hi Srinannapa,

jersey-gf-cdi.war should be CDI implementation agnostic,
so things should generally work even on Tomcat.

There might be some issues with packaging.
E.g. you have two javax.inject jars in the WEB-INF/lib:

     2497  05-16-13 18:26   WEB-INF/lib/javax.inject-1.jar
     5950  08-05-14 17:04   WEB-INF/lib/javax.inject-2.3.0-b10.jar

But not sure this is the real cause.

How do you configure CDI support in Tomcat?
If you provide me some hints, i can try to reproduce locally.

Thanks,

~Jakub

On 05 Dec 2014, at 02:50, srinannapa <[hidden email]> wrote:

>
>
> I'm trying to work CDI interceptors with Jersy abd Tomcat 7. But it never
> worked. Can some one please help me.
>
> I'm kind of trying the example provided by Jersey with some minor
> modifications.
>
> Here is my code. Interestingly I can see the message "Injected....." in the
> output, means @PostConstruct annotation is working.
>
> Please find the attached project.
>
> cdi-webapp.zip
> <http://jersey.576304.n2.nabble.com/file/n7582920/cdi-webapp.zip>  
>
>
> I'm referring to the following classes in the attached project:
>
> EchoParamFieldResource.java
> Logged
> LoggedInterceptor
> LoggedInterceptorTest
> beans.xml
>
>
>
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/CDI-with-Jersey-and-Tomcat7-Interceptors-are-never-invoked-tp7582920.html
> Sent from the Jersey mailing list archive at Nabble.com.