Quarkus - Error sending form data with date field

醉酒当歌 提交于 2020-06-29 04:22:09

问题


I'm using Quarkus version 1.5.1, however when trying to send data of type LocalDate (or Date) of a form, it returns the following error message:

java.lang.RuntimeException: RESTEASY007545: Unable to find a MessageBodyReader for media type: text / plain; charset = us-ascii and class type java.time.LocalDate

I have already imported the following dependencies, but the error persists.

<dependency>
<groupId> io.quarkus </groupId>
<artifactId> quarkus-resteasy </artifactId>
</dependency>
<dependency>
<groupId> io.quarkus </groupId>
<artifactId> quarkus-resteasy-jsonb </artifactId>
</dependency>
<dependency>
    <groupId> io.quarkus </groupId>
    <artifactId> quarkus-resteasy-jaxb </artifactId>
</dependency>
<dependency>
<groupId> io.quarkus </groupId>
<artifactId> quarkus-resteasy-jackson </artifactId>
</dependency>

Here is the code: - Controller

@POST
    @Consumes (MediaType.MULTIPART_FORM_DATA)
    @Produces (MediaType.APPLICATION_JSON)
    @Transactional
    @Path ("/ new")
    public Response addSessao (@MultipartForm @Valid Sessao sessao) {

    sessionService.insert (session);

    return Response.seeOther (URI.create ("/ sessions")). build ();
    }
  • Entity
@Column (name = "data_inicio_sessao")
@FormParam ("data_inicio_sessao")
public LocalDate dataInicioSessao;

@Column (name = "data_fim_sessao")
@FormParam ("data_fim_sessao")
public LocalDate dataFimSessao;

来源:https://stackoverflow.com/questions/62420547/quarkus-error-sending-form-data-with-date-field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!