Transaction has failed with cause 'java.lang.NullPointerException'

Hi Team,
I am getting null pointer exception when tyring to create documents using Transaction.

code

Cluster cluster = Cluster.connect("localhost", "username", "password");
Bucket bucket = cluster.bucket("travel-sample");
TransactionConfigBuilder config = TransactionConfigBuilder.create()
				.durabilityLevel("NONE");
Transactions trsLevelNone = Transactions.create(cluster, config);
List<JsonObject> jsonList  = new ArrayList<>();
try {
    trsLevelNone.run((ctx) -> {
        jsonList.forEach(dataCb -> {
						String documentId = dataCb.getString("documenId");
						ctx.insert(bucket.defaultCollection(), documentId, dataCb);
					});
        ctx.commit();
    });
} catch (TransactionCommitAmbiguous e) {
    System.err.println("Transaction possibly committed");
} catch (TransactionFailed e) {
    System.err.println("Transaction did not reach commit point");
}

Exception Log:

com.couchbase.transactions.error.TransactionFailed: Transaction has failed with cause ‘java.lang.NullPointerException’
at com.couchbase.transactions.TransactionsReactive.executeHandleErrorsPostRetry(TransactionsReactive.java:305)
at com.couchbase.transactions.TransactionsReactive.lambda$executeTransaction$4(TransactionsReactive.java:134)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94)
at reactor.core.publisher.SerializedSubscriber.onError(SerializedSubscriber.java:124)
at reactor.core.publisher.FluxRetryWhen$RetryWhenMainSubscriber.whenError(FluxRetryWhen.java:224)
at reactor.core.publisher.FluxRetryWhen$RetryWhenOtherSubscriber.onError(FluxRetryWhen.java:273)
at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.drain(FluxConcatMap.java:413)
at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.onNext(FluxConcatMap.java:250)
at reactor.core.publisher.FluxIndex$IndexSubscriber.onNext(FluxIndex.java:101)
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:120)
at reactor.core.publisher.EmitterProcessor.drain(EmitterProcessor.java:491)
at reactor.core.publisher.EmitterProcessor.tryEmitNext(EmitterProcessor.java:299)
at reactor.core.publisher.SinkManySerialized.tryEmitNext(SinkManySerialized.java:97)
at reactor.core.publisher.InternalManySink.emitNext(InternalManySink.java:27)
at reactor.core.publisher.FluxRetryWhen$RetryWhenMainSubscriber.onError(FluxRetryWhen.java:189)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:106)
at reactor.core.publisher.Operators$MonoSubscriber.onError(Operators.java:1831)
at reactor.core.publisher.MonoIgnoreThen$ThenAcceptInner.onError(MonoIgnoreThen.java:315)
at reactor.core.publisher.Operators.error(Operators.java:196)
at reactor.core.publisher.MonoError.subscribe(MonoError.java:52)
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.drain(MonoIgnoreThen.java:154)
at reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:56)
at reactor.core.publisher.Mono.subscribe(Mono.java:4046)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:103)
at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onError(FluxPeekFuseable.java:234)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onError(MonoFlatMap.java:172)
at reactor.core.publisher.Operators$MonoSubscriber.onError(Operators.java:1831)
at reactor.core.publisher.MonoIgnoreThen$ThenAcceptInner.onError(MonoIgnoreThen.java:315)
at reactor.core.publisher.Operators$MonoSubscriber.onError(Operators.java:1831)
at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreInner.onError(MonoIgnoreThen.java:243)
at reactor.core.publisher.FluxPeek$PeekSubscriber.onError(FluxPeek.java:221)
at reactor.core.publisher.FluxPeek$PeekSubscriber.onError(FluxPeek.java:221)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:106)
at reactor.core.publisher.Operators.error(Operators.java:196)
at reactor.core.publisher.MonoError.subscribe(MonoError.java:52)
at reactor.core.publisher.Mono.subscribe(Mono.java:4046)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:103)
at reactor.core.publisher.FluxSubscribeOnCallable$CallableSubscribeOnSubscription.run(FluxSubscribeOnCallable.java:230)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Suppressed: java.lang.Exception: #block terminated with an error
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:99)
at reactor.core.publisher.Mono.block(Mono.java:1703)
at com.couchbase.transactions.Transactions.run(Transactions.java:201)

Note: JsonList contains data in actual code, some entities I have prepared and added as part of code.For Illustration here , I am showing it like this.
Exception is thrown from here

can anyone tell me what I am doing wrong ? or How to correct this?

Hi @Manzoor128

Not related to your problem, but running with durability level of NONE isn’t a supported configuration, as it doesn’t provide ACID guarantees. If you’re doing it because you saw a DurabilityImpossibleException when running on a single node development cluster, then please see the note at the top of Distributed Transactions from the Java SDK | Couchbase Docs for how to solve that.

As for the error, could you please put the logs here? The TransactionFailed contains an in-memory log that may contain some clues - more details are here Distributed Transactions from the Java SDK | Couchbase Docs.

Also, what does dataCb contain?
Finally, what transactions library, Java SDK, and server versions are you running?

Alternatively if you can provide a minimal project that replicates this, I can investigate that.