Jax rs RESTEasy无法接受@PathParam类型的Long

Jax rs RESTEasy无法接受@PathParam类型的Long,jax-rs,resteasy,path-parameter,Jax Rs,Resteasy,Path Parameter,我在教程(Jersey)中看到,有可能传入类型为Long的JAX-RS@PathParam 但当我尝试使用RESTEasy执行此操作时,我遇到了一个错误: 21:50:32,353 WARN [org.jboss.resteasy.core.ExceptionHandler] (default task-15) failed to execute: javax.ws.rs.NotSupportedException: Could not find message body reader fo

我在教程(Jersey)中看到,有可能传入类型为Long的JAX-RS@PathParam

但当我尝试使用RESTEasy执行此操作时,我遇到了一个错误:

 21:50:32,353 WARN  [org.jboss.resteasy.core.ExceptionHandler] (default task-15) failed to execute: javax.ws.rs.NotSupportedException: Could not find message body reader for type: long of content type: */*
    at org.jboss.resteasy.core.interception.ServerReaderInterceptorContext.throwReaderNotFound(ServerReaderInterceptorContext.java:52)
    at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.getReader(AbstractReaderInterceptorContext.java:73)
我用Integer测试了它,但它也不起作用

22:14:45,590 WARN  [org.jboss.resteasy.core.ExceptionHandler] (default task-18) failed to execute: javax.ws.rs.NotSupportedException: Could not find message body reader for type: class java.lang.Integer of content type: */*
at org.jboss.resteasy.core.interception.ServerReaderInterceptorContext.throwReaderNotFound(ServerReaderInterceptorContext.java:52)
此外,我尝试将此ID值作为字符串,然后使用Long.valueOf(String s)Long.parseLong(String s)将其转换为Long,在这两种情况下,我都会遇到错误

Caused by: java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:601)
at java.lang.Long.parseLong(Long.java:631)
at pl.salonea.jaxrs.UserAccountResource.getUserAccount(UserAccountResource.java:41)
这是我的web服务资源方法的代码:

@GET
@Path("/{userId}")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public UserAccount getUserAccount(@PathParam("userId") String userId) {

    return userAccountFacade.find(Long.parseLong(userId));
}
已解决


我的导入不正确导入javax.ws.rs.PathParam,但来自web套接字路径参数的某些内容。。。我只是依赖IntelliJ自动导入,并没有发现它错了

感谢您对错误导入的提示-还修复了我的无关问题:D