我需要一个必须接收二进制数据的Rest服务(pdf文件) 来自客户。我有简单的休息服务如下:
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.TEXT_PLAIN)
public Response upload(@FormParam("body") String filename,
@FormParam("attachment") InputStream is) throws Exception {
System.out.println("filename: " + filename);
System.out.println("filelength: " + is.available());
return Response.ok().build();
}
当我从java客户端调用此服务时,我得到以下异常。
[ERROR] SRVE0271E:应用程序[RecieveFileApp]中的servlet [JAX-RS Servlet]创建的未捕获的init()异常:org.apache.cxf.service.factory.ServiceConstructionException 在java.lang.Class.cast(未知来源) at org.apache.cxf.bus.extension.ExtensionManagerImpl.getBeanOfType(ExtensionManagerImpl.java:322) 引起:java.lang.ClassCastException:无法将类org.apache.cxf.transport.http_jetty.continuations.JettyContinuationProviderFactory转换为接口org.apache.cxf.transport.http.ContinuationProviderFactory
由于 马杜