贾克斯RS客户端调用微服务 - > javax.ws.rs.ProcessingException:错误的参数个数

问题描述 投票:1回答:1

我有以下问题。我有JAX-RS(Glassfish的5)微服务,我写了一个客户端来检索我的微服务的数据。

一切工作正常,直到我把我的Java EE Web应用程序项目(前端)内的客户端。

例外:https://pastebin.com/vmf0pyTw

GenericClient: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

当我打电话在我的测试包的客户端,一切工作正常。

java java-ee jersey jax-rs
1个回答
1
投票

我通过改变JSON解析器和添加JsonFormat(..)我的所有日​​期的解决了这个问题

© www.soinside.com 2019 - 2024. All rights reserved.