-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinispan with dev services enabled can lead to jakarta.enterprise.inject.CreationException #5965
Comments
I created a reproducer project here: |
@karesti any ideas about this? |
@jamesnetherton yes, the dev services creates a default remote cache manager without any configuration and then when we use a cache in the code, the cache is also created by default. |
@jamesnetherton bean that won't be a synthetic bean in this case. |
The problem is that devservices is enabled by default. Which isn't really desirable for minimal code, k8s based deployments like camel-k. So users have to either explicitly disable devservices or disable the Camel |
I afraid that having dev services not enabled by default is the dev services default behaviour, I can't change that for Infinispan. But I can do that if I detect the use of Camel in the Infinispan extension |
@jamesnetherton in the Infinispan extension, I already enable and so stuff depending on extensions that might be present. |
@jamesnetherton maybe this can provide in the camel infinispan quarkus extension something like this |
Yes, I was thinking about something like that. I need to experiment a little. |
something like public class InfinispanDevServicesConfigBuilderCustomizer implements SmallRyeConfigBuilderCustomizer {
@Override
public void configBuilder(final SmallRyeConfigBuilder builder) {
// use a priority of 50 to make sure that this is overridable by any of the standard methods
builder.withSources(
new PropertiesConfigSource(
Map.of("quarkus.infinispan-client.devservices.enabled", false),
"quarkus-camel-infinispan", 50));
}
} |
In the Infinispan extesion, I do have this code as well: // dev mode client name for default
if (infinispanClientsBuildTimeConfig.defaultInfinispanClient.devService.devservices.enabled) {
clientNames.add(DEFAULT_INFINISPAN_CLIENT_NAME);
} I could disable the creation of the infinispan bean if the camel feature is present, since all this is delegated to the client. this way dev services will spin up a infinispan container after all, but without creating the bean that is not needed for this use case. We could configure the camel.component.infinispan.hosts = ${INFINISPAN_HOST:localhost}
camel.component.infinispan.username = admin
camel.component.infinispan.password = password
camel.component.infinispan.secure = true In the dev services override connecting this way to the infinispan spinned up by the dev services For what is having a cache created on startup, we can also provide a property with a default cache to be present in the server with dev services |
@jamesnetherton I'm going to implement the liked issue (to be backported) then I would suggest making use of spinning a server with Quarkus and adding extra config with a SmallRyeConfigBuilderCustomizer or whatever else for Dev Mode |
…span Dev Services is enabled Fixes apache#5965
Bug description
Consider a Camel Quarkus Infinispan application configured with the bare minimum configuration like:
Then a simple route like:
In the logs at runtime we see:
Meaning that for some reason, the Quarkus Infinispan extension has created a
RemoteCacheManager
bean, even though we never set anyquarkus.infinispan
configuration inapplication.properties
.This leads to an exception being thrown when the cache put operation occurs:
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 unwantedRemoteCacheManager
bean.The text was updated successfully, but these errors were encountered: