0

I am creating a simple form to upload a file using jersey version : 2.26. My system using grizzly HTTP container is not even starting up and giving the following error .

org.glassfish.jersey.server.model.ModelValidationException
No injection source found for a parameter

This Resource class doesn't works

import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;

@Path("image")
public class ImageResource {
    @POST
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    public Response uploadFile(
        @FormDataParam("file") InputStream uploadedInputStream,
        @FormDataParam("file") FormDataContentDisposition fileDetail) {
            return null;
    }
}

POM.XML

pom.xml

EDIT Adding the code for my grizzly server Grizzly server

final ResourceConfig rc = new ResourceConfig()
                .packages("rest.examples.jersey.main")
                .packages("rest.examples.jersey.caching")
                .packages("rest.examples.jersey.customdatatype")
                .packages("rest.examples.jersey.subresource_locator")
                .packages("rest.example.jersey.map_incoming_req_to_bean");
        // create and start a new instance of grizzly http server
        // exposing the Jersey application at BASE_URI
        HttpServer createHttpServer = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc);

Please see I have also tried this solution MULTIPART_FORM_DATA: No injection source found for a parameter of type public javax.ws.rs.core.Response In fact I have updated my solution ( jars ) from this example .

Thanks

Geek
  • 627
  • 1
  • 8
  • 18

0 Answers0