CDI Interceptors Do Not Work When Packaged in a Jar file (Stored in APP-INF/lib)
Last updated on NOVEMBER 05, 2016
Applies to:Oracle WebLogic Server - Version 18.104.22.168 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 .
Sign In with your My Oracle Support account
Don't have a My Oracle Support account? Click to get started
Million Knowledge Articles and hundreds of Community platforms