有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

找不到xml的java messagebodywriter

我请求: Response response = target.request(MediaType.APPLICATION_XML_TYPE).post(Entity.xml(inputData));

这将生成一个错误:

org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyWriter not found for media type=application/xml

从这里的其他答案中,我发现这可能是一个依赖性问题

https://stackoverflow.com/a/30820037/3592255

但我已经有了这种依赖性:

    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
        <version>2.18</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-moxy</artifactId>
        <version>2.18</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-server</artifactId>
        <version>2.18</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet-core</artifactId>
        <version>2.18</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-jaxb</artifactId>
        <version>2.18</version>
    </dependency>

如有任何意见,将不胜感激


共 (0) 个答案