My Oracle Support Banner

CDI Can't Load MDB Class Under " bean-discovery-mode="annotated" " (Doc ID 2610250.1)

Last updated on NOVEMBER 27, 2023

Applies to:

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

Symptoms

Interceptor for MDB can't manage to get the @Inject EntityManager when bean-discovery-mode="annotated" . But same code can work under bean-discovery-mode="all"

Module 1 (bean-discovery-mode="all"): Work
Module 2 (bean-discovery-mode="annotated"): Failed

a. [Module2Service] manage to get EntityManager
b. [GenericLoggingInterceptor] for [Module2Service] manage to get EntityManager
c. [Module2Mdb] manage to get EntityManager
d. [GenericLoggingInterceptor] for [Module2Mdb] FAILED to get EntityManager

<Notice> <Stdout> <BEA-000000> <##### From Original Class: [Module1Mdb], Method: onMessage>
<Notice> <Stdout> <BEA-000000> <##### Class: [Module1Mdb], Method: onMessage>
<Notice> <StdErr> <BEA-000000> <com.oracle.injection.provider.weld.WeldBeanManager createEjb
INFO: Could not find the weld descriptor for ejb: [Module2Mdb]>
<Notice> <Stdout> <BEA-000000> <##### From Original Class: [Module2Mdb], Method: onMessage>
<Notice> <Stdout> <BEA-000000> <##### Class: [Module2Mdb], Method: onMessage, Error happen>

code:
public class [Module2Mdb] implements MessageListener {
@Inject
@Database
private EntityManager entityManager;

@Inject
private ServiceToGetInject serviceToGetInject;

@Override
@Interceptors({ GenericLoggingInterceptor.class })
public void onMessage(Message message) {
......
}
}

@ApplicationScoped
public class [Module2Service] {
@Inject
@Database
private EntityManager entityManager;

@Inject
private ServiceToGetInject serviceToGetInject;

@Interceptors({ GenericLoggingInterceptor.class })
public void testMethod() {
.......
}

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


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