Skip to content
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-client] NPE during cache configuration #30304

Closed
fedinskiy opened this issue Jan 11, 2023 · 11 comments · Fixed by #32504
Closed

[infinispan-client] NPE during cache configuration #30304

fedinskiy opened this issue Jan 11, 2023 · 11 comments · Fixed by #32504
Assignees
Labels
area/cache area/infinispan Infinispan kind/bug Something isn't working
Milestone

Comments

@fedinskiy
Copy link
Contributor

Describe the bug

I am trying to add cache configuration via application.properties (scenario very similar to this one[1]). When I build and run resulting application in native mode it fails with the same error as in original issue.

[1] #29592

Expected behavior

The application should start in native mode

Actual behavior

2023-01-11 10:42:26,409 ERROR [io.qua.run.Application] (main) Failed to start application (with profile prod): java.lang.NullPointerException
	at io.quarkus.infinispan.client.runtime.InfinispanClientProducer.builderFromProperties(InfinispanClientProducer.java:239)
	at io.quarkus.infinispan.client.runtime.InfinispanClientProducer.initialize(InfinispanClientProducer.java:66)
	at io.quarkus.infinispan.client.runtime.InfinispanClientProducer.remoteCacheManager(InfinispanClientProducer.java:367)
	at io.quarkus.infinispan.client.runtime.InfinispanClientProducer_ProducerMethod_remoteCacheManager_b4943dc6282b3982ac4ff16d7d4370041f920ead_Bean.create(Unknown Source)
	at io.quarkus.infinispan.client.runtime.InfinispanClientProducer_ProducerMethod_remoteCacheManager_b4943dc6282b3982ac4ff16d7d4370041f920ead_Bean.get(Unknown Source)
	at io.quarkus.infinispan.client.runtime.InfinispanClientProducer_ProducerMethod_remoteCacheManager_b4943dc6282b3982ac4ff16d7d4370041f920ead_Bean.get(Unknown Source)
	at io.quarkus.ts.infinispan.client.InfinispanClientApp_Bean.create(Unknown Source)
	at io.quarkus.ts.infinispan.client.InfinispanClientApp_Bean.create(Unknown Source)
	at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:113)
	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:37)
	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:34)
	at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
	at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
	at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:34)
	at io.quarkus.ts.infinispan.client.InfinispanClientApp_Observer_onStart_e42ebeb6c77764031cb851cfc650b8cff43d9f5b.notify(Unknown Source)
	at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:326)
	at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:308)
	at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:76)
	at io.quarkus.arc.runtime.ArcRecorder.fireLifecycleEvent(ArcRecorder.java:131)
	at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:100)
	at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy_0(Unknown Source)
	at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy(Unknown Source)
	at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
	at io.quarkus.runtime.Application.start(Application.java:101)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:110)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:69)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:122)

How to Reproduce?

  1. git clone [email protected]:fedinskiy/reproducer.git -b feature/inifinispan-native
  2. mvn clean install -Pnative -Dquarkus.platform.version=2.15.3.Final #version 2.13.1.Final also affected
  3. target/infinispan-1.0.0-SNAPSHOT-runner

Output of uname -a or ver

6.0.18-300.fc37.x86_64

Output of java -version

17.0.4, vendor: GraalVM Community

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.15.3.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)

Additional information

No response

@fedinskiy fedinskiy added the kind/bug Something isn't working label Jan 11, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Jan 11, 2023

/cc @gwenneg(cache), @karesti(infinispan), @wburns(infinispan)

@karesti karesti self-assigned this Jan 11, 2023
@karesti
Copy link
Member

karesti commented Jan 11, 2023

taking the point @fedinskiy

@karesti
Copy link
Member

karesti commented Mar 7, 2023

@fedinskiy I've checked the configuration, and as far as I know, if we want to include the file, in this case the xml file, we need to configure quarkus.native.resources.includes properties
@geoand @gsmet is this correct?
I'm wondering if we can improve the use case by configuring the includes property automatically if the configuration file is provided. In any case, this does not seem like a bug to me

@karesti
Copy link
Member

karesti commented Mar 7, 2023

@fedinskiy sorry for the time it got me to come to this one

@geoand
Copy link
Contributor

geoand commented Mar 7, 2023

Yes, that's true. Is this some custom file or a standard configuration file?

@karesti
Copy link
Member

karesti commented Mar 7, 2023

@geoand it's a file that the user will add with the configuration of the cache (xml, json or yaml) that will be placed in the resources. in the it test of the extension, I configure the native resources includes.
https://github.com/quarkusio/quarkus/blob/main/integration-tests/infinispan-client/src/main/resources/application.properties#L10

What I've seen is that nothing is mentioned in the Infinispan Guide that can help on it. I can add it and close this issue if nothing else should be done in the code at this point

@geoand
Copy link
Contributor

geoand commented Mar 7, 2023

I see.

In this case (where the configuration is supplied at runtime and therefore not known at build time), there is no alternative but to add the quarkus.native.resources.includes configuration.

@geoand
Copy link
Contributor

geoand commented Mar 7, 2023

Although, now that I think about it more... a user won't be able to provide a different classpath value for quarkus.infinispan-client.cache.default.configuration-uri than the one provided in quarkus.native.resources.includes...

So perhaps quarkus.infinispan-client.cache.default.configuration-uri needs to be split... And have one property for classpath resources which would be set build time only and one for file system resources which can be overriden at runtime.
It's not a great experience, but then again, neither is what we have now...

@karesti
Copy link
Member

karesti commented Mar 8, 2023

@wburns what do you think on this one?

@karesti
Copy link
Member

karesti commented Apr 8, 2023

@geoand I'm thinking that this should be build time config instead of runtime config. If a user needs a runtime cache to be created, can do it with the remote cache manager. however, when we build the extension with a file inside and configuring a cache on properties, I think this lands into deployment config and not runtime config. what do you think ?

@karesti
Copy link
Member

karesti commented Apr 8, 2023

@geoand @wburns created this PR, in draft now #32504

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cache area/infinispan Infinispan kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants