0
Resteasy를 사용하고 있으며 내 리소스에서 문자열 목록 만 반환하려고합니다. JSON과 작동하지만 XML의 경우 Could not find MessageBodyWriter for response object of type: java.util.ArrayList of media type: application/xml
이라는 오류가 있습니다.No MessageBodyWriter for application/xml
어떻게해야합니까? 웹에서 옵션을 시도했지만 아무것도 작동하지 않았습니다. pom.xml 파일에서
는@GET
@Path("")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Wrapped(element = "resources")
public Response getResources() {
List<String> resources = ts.getAllResources();
//GenericEntity<List<String>> entity = new GenericEntity<List<String>>(resources) {};
return Response.ok().entity(new GenericEntity<List<String>>(resources) {}).build();
//return Response.ok(resources).build();
//return resources;
}
추출
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>${jboss.resteasy.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-servlet-initializer</artifactId>
<version>${jboss.resteasy.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<version>${jboss.resteasy.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-atom-provider</artifactId>
<version>${jboss.resteasy.version}</version>
</dependency>
UPDATE : 나는대로 제이보스 (10)
WFLYSRV0059: Class Path entry jaxb-api.jar in /D:/Dev/Servers/wildfly-10.0.0.Final/standalone/deployments/service.war/WEB-INF/lib/jaxb-core-2.2.7.jar does not point to a valid jar for a Class-Path reference.
클래스에'@ XmlRootElement' 주석을 달고 있습니까? – taoxiaopang
어떤 등급입니까? 웹 서비스를 구현하는 사람? – jlanza