Jax RS 客户端调用微服务 -> javax.ws.rs.ProcessingException:参数数量错误
Jax RS Client calling Microservices -> javax.ws.rs.ProcessingException: wrong number of arguments
我遇到了以下问题。我有 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(..) 添加到我所有的
来解决这个问题
我遇到了以下问题。我有 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(..) 添加到我所有的
来解决这个问题