quarkusio/quarkus · error · BeanNotFoundException
No matching bean in CDI context for type ${typeReference} an
Error message
No matching bean in CDI context for type ${typeReference} and @Named(${nameReference}) What it means
ArcBeanProvider.forTypeAndName() resolves a bean by type plus a @Named qualifier using NamedLiteral.of(nameReference). If ArC finds no bean matching both the type and the name, it throws BeanNotFoundException with the type and name in the message. This means the @Named value used in Hibernate Search configuration does not match any bean's @Named annotation.
Source
Thrown at extensions/hibernate-search-standalone-elasticsearch/runtime/src/main/java/io/quarkus/hibernate/search/standalone/elasticsearch/runtime/bean/ArcBeanProvider.java:36
@Override
public void close() {
// Nothing to do
}
@Override
public <T> BeanHolder<T> forType(Class<T> typeReference) {
var instance = delegate.instance(typeReference);
if (!instance.isAvailable()) {
throw new BeanNotFoundException("No matching bean in CDI context for type " + instance);
}
return new ArcBeanHolder<>(instance);
}
@Override
public <T> BeanHolder<T> forTypeAndName(Class<T> typeReference, String nameReference) {
var instance = delegate.instance(typeReference, NamedLiteral.of(nameReference));
if (!instance.isAvailable()) {
throw new BeanNotFoundException(
"No matching bean in CDI context for type " + typeReference + " and @Named(" + nameReference + ")");
}
return new ArcBeanHolder<>(instance);
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Add or correct @Named(nameReference) on the bean of the requested type so it matches the configured name exactly (case-sensitive).
- Grep your configuration for the name value and fix typos or stale names after refactoring.
- Ensure the bean is bean-defining (e.g. @ApplicationScoped + @Named) so ArC registers it.
- Alternatively switch to nameless resolution (forType) if a unique bean of the type exists.
- Catch BeanNotFoundException and print the requested type/name pair to pinpoint the mismatched config entry.
Example fix
// before: name mismatch
@ApplicationScoped
public class MyBean { ... }
// config: ...bean-name=MyNamedBean
// after
@ApplicationScoped
@Named("MyNamedBean")
public class MyBean { ... } Defensive patterns
Strategy: validation
Validate before calling
// Verify a @Named bean of the right type exists before configuring it
boolean ok = Arc.container().select(MyType.class, NamedLiteral.of("MyNamedBean")).isResolvable();
if (!ok) {
throw new IllegalStateException("No @Named(\"MyNamedBean\") bean of type " + MyType.class);
} Type guard
public static <T> boolean hasNamedCdiBean(Class<T> type, String name) {
return Arc.container() != null
&& Arc.container().select(type, NamedLiteral.of(name)).isResolvable();
} Try / catch
try {
BeanHolder<T> holder = beanProvider.forTypeAndName(MyType.class, "MyNamedBean");
} catch (BeanNotFoundException e) {
log.errorf("No @Named bean for type=%s name=%s — fix @Named annotation or config value", MyType.class, "MyNamedBean", e);
} Prevention
- Keep bean names in a constants class shared between the @Named annotation and configuration.
- Remember @Named values are case-sensitive — avoid ad-hoc string edits in properties.
- Verify the bean has both a scope and @Named so it is bean-defining.
- After renaming a bean, update every config reference to the old name.
When it happens
Trigger: Calling forTypeAndName(Class<T>, String) where no bean of typeReference carries @Named(nameReference) — e.g. Hibernate Search config references a named bean that does not exist, or exists under a different name/type.
Common situations: Typo in the bean name in quarkus.hibernate-search-standalone.* properties; bean renamed during refactoring while config still references the old name; the bean has @Named on the wrong element or with different case (names are case-sensitive); the bean type was changed so it no longer matches.
Related errors
- Multiple instances of %1$s were found for Hibernate Search i
- Multiple instances of %1$s were found for Hibernate Search b
- Multiple instances of %1$s were found for Hibernate Search i
- No matching bean in CDI context for type ${instance}
- Multiple instances of %1$s were found for Hibernate Search S
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/2924d552304246c7.
Report an issue: GitHub.