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 Client Extension - NullPointerException in native mode with ChangeStreamDocumentCodec #342

Closed
snowdrop-bot opened this issue May 24, 2021 · 0 comments
Assignees
Labels
7 - Community development upstream/closed The issue has been closed in the upstream repository

Comments

@snowdrop-bot
Copy link
Collaborator

Describe the bug

MongoDb client does not contain registration for reflection of ChangeStreamDocument. Therefore it causes NPE in https://github.com/mongodb/mongo-java-driver/blob/master/driver-core/src/main/com/mongodb/client/model/changestream/ChangeStreamDocumentCodec.java#L44

To Reproduce

You can use camel-quarkus and its test. Following change has to be present - apache/camel-quarkus#2642
Then you have to:

  1. Remove workaround of this issue, be removing method MongoDbProcessor.reflectiveClass (https://github.com/apache/camel-quarkus/pull/2642/files#diff-a69e11de2fa675737)
  2. Run tests from module integration-tests/mongodb in native mode. You can use command mvn clean verify -Pnative -f integration-tests/mongodb
    Following exception should happen:
2021-05-24 12:06:36,062 ERROR [org.apa.cam.imp.eng.AbstractCamelContext] (main) Error starting CamelContext (camel-1) due to exception thrown: null: java.lang.NullPointerException
	at com.mongodb.client.model.changestream.ChangeStreamDocumentCodec.<init>(ChangeStreamDocumentCodec.java:45)
	at com.mongodb.client.model.changestream.ChangeStreamDocument.createCodec(ChangeStreamDocument.java:296)
	at com.mongodb.client.internal.ChangeStreamIterableImpl.<init>(ChangeStreamIterableImpl.java:84)
	at com.mongodb.client.internal.MongoCollectionImpl.createChangeStreamIterable(MongoCollectionImpl.java:380)
	at com.mongodb.client.internal.MongoCollectionImpl.watch(MongoCollectionImpl.java:352)
	at com.mongodb.client.internal.MongoCollectionImpl.watch(MongoCollectionImpl.java:347)
	at org.apache.camel.component.mongodb.MongoDbChangeStreamsThread.initializeCursor(MongoDbChangeStreamsThread.java:51)
	at org.apache.camel.component.mongodb.MongoDbChangeStreamsThread.init(MongoDbChangeStreamsThread.java:45)
	at org.apache.camel.component.mongodb.MongoDbChangeStreamsConsumer.doStart(MongoDbChangeStreamsConsumer.java:69)
	at org.apache.camel.support.service.BaseService.start(BaseService.java:115)
	at org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:113)
	at org.apache.camel.impl.engine.AbstractCamelContext.startService(AbstractCamelContext.java:3474)
	at org.apache.camel.impl.engine.InternalRouteStartupManager.doStartOrResumeRouteConsumers(InternalRouteStartupManager.java:401)
	at org.apache.camel.impl.engine.InternalRouteStartupManager.doStartRouteConsumers(InternalRouteStartupManager.java:319)
	at org.apache.camel.impl.engine.InternalRouteStartupManager.safelyStartRouteServices(InternalRouteStartupManager.java:213)
	at org.apache.camel.impl.engine.InternalRouteStartupManager.doStartOrResumeRoutes(InternalRouteStartupManager.java:147)
	at org.apache.camel.impl.engine.AbstractCamelContext.doStartCamel(AbstractCamelContext.java:3177)
	at org.apache.camel.impl.engine.AbstractCamelContext.doStartContext(AbstractCamelContext.java:2861)
	at org.apache.camel.impl.engine.AbstractCamelContext.doStart(AbstractCamelContext.java:2812)
	at org.apache.camel.support.service.BaseService.start(BaseService.java:115)
	at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2507)
	at org.apache.camel.quarkus.main.CamelMain.doStart(CamelMain.java:94)
	at org.apache.camel.support.service.BaseService.start(BaseService.java:115)
	at org.apache.camel.quarkus.main.CamelMain.startEngine(CamelMain.java:139)
	at org.apache.camel.quarkus.main.CamelMainRuntime.start(CamelMainRuntime.java:49)
	at org.apache.camel.quarkus.core.CamelBootstrapRecorder.start(CamelBootstrapRecorder.java:45)
	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy_0(CamelBootstrapProcessor$boot-173480958.zig:101)
	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy(CamelBootstrapProcessor$boot-173480958.zig:40)
	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:763)
	at io.quarkus.runtime.Application.start(Application.java:90)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:100)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:119)
	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)

Quarkus version:
Running Quarkus native-image plugin on GraalVM Version 21.0.0.2 (Java Version 11.0.10+8-LTS-jvmci-21.0-b06)


quarkusio#17432


$upstream:17432$

@snowdrop-bot snowdrop-bot added the upstream/closed The issue has been closed in the upstream repository label May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
7 - Community development upstream/closed The issue has been closed in the upstream repository
Projects
None yet
Development

No branches or pull requests

2 participants