<找不到媒体类型=应用程序/json的MessageBodyWriter,使用JDeveloper



我正试图使用Jakarta RESTful Web Services返回json格式的数据然而,在使用Jdeveloper时,我收到了以下http内部服务器错误500 的错误

这是以下RestClass

import java.util.concurrent.atomic.AtomicLong;
import javax.ws.rs.Encoded;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
@Path("hello")
public class RestClass {

private final AtomicLong count = new AtomicLong();

@GET
@Path("/print/{name}")
@Produces(MediaType.APPLICATION_JSON)
public Hello getHellos(@PathParam("name") String myName ) {
Hello hello = new Hello(count.incrementAndGet(), myName);
return hello;

}
}

im使用以下jar文件

asm-3.1.jar
jersey-core-1.18.jar
jersey-json-1.19.jar
jersey-server-1.18.jar
jersey-servlet-1.18.jar

在Hello class中添加了一个空构造函数后,问题得到了修复,但现在它返回了一个空白的JSON对象

最新更新