My Oracle Support Banner

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

Last updated on OCTOBER 09, 2023

Applies to:

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


 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 .




To view full details, sign in with your My Oracle Support account.

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

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.