Failed to serialize object MultipartFile

Hi Team,

Here i’m using one rest controller to upload the file in s3. I did business logic in the service layer but i’m not able to send the file(multipart file) to service layer getting “Failed to serialize object” error. please help me out to fix this issue.
image

Hi,
You can not pass the MultipartFile to the service layer, because this object is part of Spring MVC and can not be serialized to be passed to core block.

You should use the MultipartFile.getBytes() method to read file contents in the rest controller, and then pass byte array further in the code.

1 Like

Thanks buddy… :v: