CDI Interceptors Do Not Work When Packaged in a Jar file (Stored in APP-INF/lib) (Doc ID 1571996.1)

Last updated on NOVEMBER 05, 2016

Applies to:

Oracle WebLogic Server - Version 12.1.1.0 and later
Information in this document applies to any platform.

Symptoms

 A J2EE application consists of 2 EJB modules and a common Jar library  (stored in APP-INF/lib) :
  - Ejb1.jar (containing EJB BeanWithInterceptor class)
  - Ejb2.jar (containing EJB AnotherBeanWithInterceptor class)
  - APP-INF/lib/commonLib.jar (containing interceptor MethodInvocationInterceptor class)

Interceptor type (Tracing) is packaged in a Jar library (commonLib.jar).

The EJb2 (AnotherBeanWithInterceptor class packaged in Ejb2.jar) is invoking Ejb1 (BeanWithInterceptor class packaged in Ejb1.jar) hello() method .
Here is the EJB bean Ejb1 which is invoked and intercepted :



The problem is that the interceptor handleTrace() method of MethodInvocationInterceptor class
is not invoked - when this interceptor class is stored in the APP-INF/lib directory.

Note that copying the interceptor class ( MethodInvocationInterceptor) in Ejb2.jar ,
then the interceptor handleTrace() method is invoked . Note that it is
the MethodInvocationInterceptor class stored in the APP-INF/lib/commonLib.jar
but not MethodInvocationInterceptor class stored in in Ejb2.jar .

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms