Skip to content

CoroutineUtils- Mono - ClassCastException coming when upgrading Springboot to 3.4.1 #34288

@rgcs2299

Description

@rgcs2299

Hi Team,

We have upgraded springboot version from 3.1.2 to 3.4.1 as per the latest stable version.
We are seeing class cast exceptions while fetching the objects from database via JPA with return type as Mono.
If we change the Mono to Flux it is working fine.

Exception Stack Trace:

Original Stack Trace:\n\t\tat org.springframework.core.CoroutinesUtils.lambda$invokeSuspendingFunction$4(CoroutinesUtils.java:135)\n","error.stack_trace":"java.lang.ClassCastException: class com.entity cannot be cast to class reactor.core.publisher.Mono (com.entity and reactor.core.publisher.Mono are in unnamed module of loader 'app')

This used to work fine before upgrading

suspend fun findByUpiReqId(upiRequestId: String): Mono<TransactionDetails>

If we change it to Flux it works fine now , after upgrading

suspend fun findByUpiReqId(upiRequestId: String): Flux<TransactionDetails>

Springboot reactive application in Kotlin (v1.8).

Can you please look into this !

Metadata

Metadata

Assignees

Labels

theme: kotlinAn issue related to Kotlin support

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions