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

[Mongodb] NPE getting reactive client #11765

Closed
squakez opened this issue Sep 1, 2020 · 4 comments
Closed

[Mongodb] NPE getting reactive client #11765

squakez opened this issue Sep 1, 2020 · 4 comments
Labels
area/mongodb kind/bug Something isn't working
Milestone

Comments

@squakez
Copy link
Contributor

squakez commented Sep 1, 2020

Describe the bug
When creating a named "blocking" client connection in a camel application (using quarkus extensions), I am hitting a NPE.

Expected behavior
Should not receive the NPE

Actual behavior
During startup, the application fail with the following exception:

2020-09-01 09:59:29,280 ERROR [io.qua.application] (Quarkus Main Thread) Failed to start application (with profile dev): java.lang.NullPointerException
	at java.base/java.util.Objects.requireNonNull(Objects.java:221)
	at io.quarkus.runtime.RuntimeValue.<init>(RuntimeValue.java:15)
	at io.quarkus.mongodb.runtime.MongoClientRecorder.getReactiveClient(MongoClientRecorder.java:47)
	at io.quarkus.deployment.steps.MongoClientProcessor$mongoClients-1417000131.deploy_0(MongoClientProcessor$mongoClients-1417000131.zig:103)
	at io.quarkus.deployment.steps.MongoClientProcessor$mongoClients-1417000131.deploy(MongoClientProcessor$mongoClients-1417000131.zig:40)
	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:576)
	at io.quarkus.runtime.Application.start(Application.java:90)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:92)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:61)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:106)
	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.runner.bootstrap.StartupActionImpl$3.run(StartupActionImpl.java:145)
	at java.base/java.lang.Thread.run(Thread.java:834)

To Reproduce
Steps to reproduce the behavior:

  1. Create a simple application with a named blocking connection (ie, @Inject @MongoClientName("mongoClient1") MongoClient mongoClient1;)
  2. Run and see the failure

Configuration

# Add your application.properties here, if applicable.

Screenshots
(If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

  • Output of uname -a or ver: 5.4.0-42-generic Add proper logging #46~18.04.1-Ubuntu x86_64 x86_64 x86_64 GNU/Linux
  • Output of java -version: openjdk version "11.0.7" 2020-04-14
  • GraalVM version (if different from Java):
  • Quarkus version or git rev: master (999-SNAPSHOT)
  • Build tool (ie. output of mvnw --version or gradlew --version): mvn 3.6.3

Additional context
(Add any other context about the problem here.)

@squakez squakez added the kind/bug Something isn't working label Sep 1, 2020
@quarkusbot
Copy link

/cc @loicmathieu, @evanchooly

@squakez
Copy link
Contributor Author

squakez commented Sep 1, 2020

I think I spot the possible source of the error though, going to submit a PR for your evaluation

squakez added a commit to squakez/quarkus that referenced this issue Sep 1, 2020
* Removing the reactive suffix in order to get the existing client (instead of getting null)
* Changing anonymous classes to lambdas
* Fixed the suppress warning with unused

Closes quarkusio#11765
squakez added a commit to squakez/quarkus that referenced this issue Sep 1, 2020
* Removing the reactive suffix in order to get the existing client (instead of getting null)
* Fixed the suppress warning with unused

Closes quarkusio#11765
@loicmathieu
Copy link
Contributor

Hello,
Before we can pursue with your PR, can you create a minimal reproducer as this code is tested in our CI and we didn't have any NPE.
You mention Camel in your issue description, maybe it's an issue on the way Camel interract with the mongodb-client extension.

@geoand
Copy link
Contributor

geoand commented Sep 1, 2020

+1 for what @loicmathieu says

squakez added a commit to squakez/quarkus that referenced this issue Sep 1, 2020
* Adding a flag to create named qualifier as reactive client or not
* Fixed the suppress warning with unused

Closes quarkusio#11765
@geoand geoand closed this as completed in e73106f Sep 1, 2020
geoand added a commit that referenced this issue Sep 1, 2020
Fix reactive Mongo client CDI handling
@gsmet gsmet added this to the 1.8.0.CR1 milestone Sep 2, 2020
gsmet pushed a commit to gsmet/quarkus that referenced this issue Sep 2, 2020
Adding a flag to create named qualifier as reactive client or not

Fixes: quarkusio#11765
geoand pushed a commit to geoand/quarkus that referenced this issue Sep 3, 2020
Adding a flag to create named qualifier as reactive client or not

Fixes: quarkusio#11765
(cherry picked from commit e73106f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/mongodb kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants