All my rest service stops working when I add this code:
@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, 0, read); } entityToMerge.setTestBlob(out.toByteArray()); super.edit(entityToMerge); } catch (IOException e) { e.printStackTrace(); } }
It doesn't really say why, all I get is:
Severe: WebModule[/MavenProjectTest]StandardWrapper.Throwable org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization.
And a bunch of mistakes saying "because of previous mistakes"
I must have done something really wrong, are there any professional JPA juniors that can help me a bit here?
Edit: I use annotations instead of web.xml, can this be done without web.xml?
source share