java - Jax RS 客户端调用微服务 -> javax.ws.rs.ProcessingException : wrong number of arguments

标签 java jakarta-ee jersey jax-rs

我遇到了以下问题。我有 JAX-RS (Glassfisch 5) 微服务​​,并且编写了一个客户端来从我的微服务中检索数据。

一切都工作正常,直到我将客户端移至我的 Java EE Web 应用程序项目(前端)中。

异常:https://pastebin.com/vmf0pyTw

通用客户端:https://pastebin.com/MwUjTyx5

UserStoryClient 扩展了 GenericClient:

@RequestScoped
@Named
public class UserStoryClient extends GenericClient<UserStory>{
    public UserStoryClient() {
        super(Consts.USERSTORY_RESOURCEURI, new GenericType<UserStory>(){}, new GenericType<List<UserStory>>(){});
    }

    public Optional<List<UserStory>> getByUserId(int id) {
        Response response = this.getResourceWebTarget()
                .path(Consts.USER_RESOURCEURI)
                .path(String.valueOf(id))
                .request(MediaType.APPLICATION_JSON)
                .get(Response.class);
        return this.retrieveEntityList(response);
    }
}

@RequestScoped
@Named
@Getter @Setter
public class IssueCreateBoundary implements Serializable {
    UserStory userStory = new UserStory();
    @Inject UserStoryClient userStoryGroup;
    private Integer priorityRating;    
    private Integer riskRating;    

    public void submitIssue(){
        if(priorityRating != null)   userStory.setPriority(priorityRating.byteValue());
        if(riskRating != null) userStory.setRisk(riskRating.byteValue());
        
        Optional<UserStory> resp = this.userStoryGroup.create(userStory);
    }
}

Pom.xml:https://pastebin.com/1kZxNCKQ

当我在测试包中调用客户端时,一切正常。

最佳答案

我通过更改 JSON 解析器并向所有日期添加 JsonFormat(..) 解决了这个问题

关于java - Jax RS 客户端调用微服务 -> javax.ws.rs.ProcessingException : wrong number of arguments,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51030106/

相关文章:

java - 试图在 LibGDX 中画一个圆圈

java - 结果集返回 3 行,但我只能打印 2 行?

java - 如果未提供范围,为什么 Glassfish 不会启动失败但 Tomcat 会启动?

Java,如何在纯java中使用表达式语言

jersey - 注释 Web 方法参数时,JAX-RS Jersey 客户端获得 400 响应

java - UrlRewriteFilter 直接转https

java - 我的其余服务无法识别授权 :Bearer

servlets - 将共享代码和 web.xml 从 WAR 项目拆分为通用 JAR 项目

java - Spring 安全和 Jersey : no automatic redirection to the login site

java - 删除向导请求响应日志记录