apache / apache/camel-quarkus

Infinispan with dev services enabled can lead to jakarta.enterprise.inject.CreationException

Open
#5,965 12 comments 0 reactions 1 assignee Claimed by @jamesnetherton View on GitHub
area/infinispan bug
Dominant language
Java
Stars
302
Forks
232
Avg merge
1d 20h
Merged PRs (30d)
114

Description

### Bug description

Consider a Camel Quarkus Infinispan application configured with the bare minimum configuration like:

```
camel.component.infinispan.hosts = localhost
```

Then a simple route like:

```
from("direct:cachePut")
.setHeader("CamelInfinispanKey").constant("foo")
.setHeader("CamelInfinispanValue").constant("bar")
.to("infinispan:test?operation=PUT")
.log("Cache PUT : ${header.CamelInfinispanKey} = ${header.CamelInfinispanValue}");
```

In the logs at runtime we see:

```
Autowired property: cacheContainer on component: infinispan as exactly one instance of type: org.infinispan.client.hotrod.RemoteCacheManager (org.infinispan.client.hotrod.RemoteCacheManager_3e5ozT9gyWKQ9VvCN1iNcOXJaqs_Synthetic_ClientProxy) found in the registry
```

Meaning that for some reason, the Quarkus Infinispan extension has created a `RemoteCacheManager` bean, even though we never set any `quarkus.infinispan` configuration in `application.properties`.

This leads to an exception being thrown when the cache put operation occurs:

```
jakarta.enterprise.inject.CreationException: Null contextual instance was produced by a normal scoped synthetic bean: SYNTHETIC bean [class=org.infinispan.client.hotrod.RemoteCacheManager
```

The error goes away if you set `quarkus.infinispan-client.devservices.enabled=false`. So there's something about having dev services enabled that leads to the creation of the unwanted `RemoteCacheManager` bean.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.