Inteceptors doesn't work in Message Driven Bean

264 views Asked by At

I was trying to use method level interceptor from message driven bean. But i use it, interceptor was not called but when i used interceptor on class level or if put @interceptors(sampleInterceptor.class) on onMessage method it's working.

Any body has any idea why interceptors is not being called when you put @interceptors(sampleInterceptor.class) on any private methods in Message driven bean?

I am using glassfish server 4.0

1

There are 1 answers

1
Gabriel Aramburu On BEST ANSWER

According to ejb3.1 specification:

Interceptor methods may be defined for business methods of sessions beans and for the message listener methods of message-driven beans.

A message listener method must follow several rules, one of them is:

The method must be declared as public.