java停止上传,java – JPA休息在尝试上传blob时停止工作

当我添加此代码时,我的整个休息服务停止工作:

@PUT

@Path("upload/{id}")

@Consumes(MediaType.MULTIPART_FORM_DATA)

public void addBlob(@PathParam("id") Integer id,@FormDataParam("file") InputStream uploadedInputStream) throws IOException {

TheTempClient entityToMerge = find(id);

try {

ByteArrayOutputStream out = new ByteArrayOutputStream();

int read = 0;

byte[] bytes = new byte[1024];

while ((read = uploadedInputStream.read(bytes)) != -1) {

out.write(bytes,read);

}

entityToMerge.setTestBlob(out.toByteArray());

super.edit(entityToMerge);

}

catch (IOException e) {

e.printStackTrace();

}

}

它没有真正说明为什么,我得到的只是:

Severe: WebModule[/MavenProjectTest]StandardWrapper.Throwable

org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has Failed during application initialization.

还有一堆错误说“由以前的错误引起的”

我一定在这里做了一些非常错误的事,有没有专业的JPA爱好者可以在这里帮助我一点点?

编辑:我正在使用注释而不是web.xml,是否可以在没有web.xml的情况下执行此操作?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值