javax.ws.rs.ProcessingException: RESTEASY003145: Невозможно найти MessageBodyReader типа содержимого application / xml и интерфейса типа java.util.List - PullRequest
0 голосов
/ 29 августа 2018

Я реализовал простую конечную точку отдыха, которая возвращает Ответ, содержащий

List<String>

Клиент реализован с использованием jaxrs 2.0 и resteasy как подразумевается, так как я использую wildfly в своем проекте. Когда я получаю результаты, я продолжаю делать следующее исключение

javax.ws.rs.ProcessingException: RESTEASY003145: Unable to find a MessageBodyReader of content-type application/xml and type interface java.util.List

at org.jboss.resteasy.core.interception.ClientReaderInterceptorContext.throwReaderNotFound(ClientReaderInterceptorContext.java:42)
at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.getReader(AbstractReaderInterceptorContext.java:80)
at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:53)
at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readFrom(ClientResponse.java:324)
at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readEntity(ClientResponse.java:251)
at org.jboss.resteasy.specimpl.BuiltResponse.readEntity(BuiltResponse.java:245)

Вот код от клиента, который выдает ошибку. Если я запрашиваю JSON, он работает нормально, но с xml я получаю указанное выше исключение.

Invocation.Builder request = rTarget.path("/containers/instances/{id}/kbase/{kbaseName}").resolveTemplate("id", containerAlias).resolveTemplate("kbaseName", getKbase()).
            request(MediaType.APPLICATION_XML).accept(MediaType.APPLICATION_XML);

    return request.get().readEntity(new GenericType<List<String>>(){});

и вот мои зависимости пока

<!-- Test scope dependencies -->
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-client</artifactId>
        <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.jboss.resteasy/jaxrs-api -->
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>jaxrs-api</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jackson2-provider</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jackson-provider</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxb-provider</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-multipart-provider</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jettison-provider</artifactId>
        <scope>test</scope>
    </dependency>

любая помощь, мы будем очень признательны. Заранее спасибо

...