My Oracle Support Banner

Interceptor Class @PostConstruct Method Is Not Called on 12.2.1 (Doc ID 2328025.1)

Last updated on SEPTEMBER 15, 2023

Applies to:

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

Symptoms

The @PostConstruct method can't be invoked by Interceptopr class on 12.2.1. But same @PostConstruct method invoked on 10.3.6

When calling ejb test, Below output shown in 10.3.6 log, but missing on 12.2.1.
"
MyInterceptor init()@PostConstruct
"

Refer:

1. This is Interceptopr code

package com.aaron.test.interpretors;
import javax.annotation.PostConstruct;
import javax.interceptor.AroundInvoke;
import javax.interceptor.InvocationContext;

public class MyInterceptor {

public MyInterceptor(){
System.out.println("MyInterceptor()");
}

@PostConstruct
public void init(InvocationContext context) throws Exception {
System.out.println("MyInterceptor init()@PostConstruct");
context.proceed();
}

@AroundInvoke
public Object invoke(InvocationContext context) throws Exception {
System.out.println("MyInterceptor invoke()@AroundInvoke");
return context.proceed();
}

}

2. This is EJB code

import com.aaron.test.interpretors.MyInterceptor;
import javax.annotation.PostConstruct;
import javax.ejb.Stateless;
import javax.interceptor.Interceptors;

@Stateless
public class MyBean{

public MyBean(){
System.out.println("MyBean()");
}

@PostConstruct
public void init() {
System.out.println("MyBean init()@PostConstruct");
}

@Interceptors(value=MyInterceptor.class)
public void sale(){
System.out.println("MyBean sale()@Interceptors");
}
}

 

Cause

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
Symptoms
Cause
Solution
References


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