Casting Issue with StreamingFileUpload in Generated Controller Methods #11101
Unanswered
rsalbergaria
asked this question in
Q&A
Replies: 1 comment 1 reply
-
We are currently migrating a test project to use Micronaut parent version 4.4.2 and have encountered a ClassCastException when using StreamingFileUpload. java.lang.ClassCastException: class reactor.core.publisher.MonoOnAssembly cannot be cast to class io.micronaut.http.multipart.StreamingFileUpload (reactor.core.publisher.MonoOnAssembly and io.micronaut.http.multipart.StreamingFileUpload are in unnamed module of loader 'app') |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone,
We are encountering issues with the usage of io.micronaut.http.multipart.StreamingFileUpload.
Recently, we decided to add support for StreamingFileUpload and are facing a casting issue that we have not yet identified the cause of, especially since io.micronaut.http.multipart.CompletedFileUpload works fine. I am posting this question here to seek help.
Here is a simple example of the method signature generated for our controller adapter:
public Mono<HttpResponse<Void>> postDocumento( io.micronaut.http.HttpRequest<?> req, @NotNull @Parameter(name = "file", in = ParameterIn.DEFAULT, required = true, schema = @Schema(name = "file", implementation = StreamingFileUpload.class, required = true)) @Body("file") StreamingFileUpload file, @NotNull @Parameter(name = "id", in = ParameterIn.PATH, description = "ID do cliente", required = true, schema = @Schema(name = "id", implementation = Long.class, required = true)) @PathVariable("id") Long id )
And here is the error we are receiving:
Invalid type [io.micronaut.http.server.netty.binders.PublisherBodyBinder$$Lambda/0x0000007001616d30] for argument [StreamingFileUpload file] of method: Mono<HttpResponse<Void>> postDocumento(HttpRequest<Object> req, StreamingFileUpload file, Long id) java.lang.IllegalArgumentException: Invalid type [io.micronaut.http.server.netty.binders.PublisherBodyBinder$$Lambda/0x0000007001616d30] for argument [StreamingFileUpload file] of method: Mono<HttpResponse<Void>> postDocumento(HttpRequest<Object> req, StreamingFileUpload file, Long id)
One of the problems is that since the object is shown as a memory address, we are unable to identify the type. We are using Micronaut parent version 3.10.3, which includes the version of the HTTP server Netty.
Any help or guidance on this issue would be greatly appreciated.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions