Home » Java » WELD-001408 Unsatisfied dependencies of MultiPartReaderServerSide when using Jersey with Weblogic server

WELD-001408 Unsatisfied dependencies of MultiPartReaderServerSide when using Jersey with Weblogic server

Posted by: admin October 26, 2017 Leave a comment

Questions:

I’m trying to create a mock servlet with some stub responses. For one endpoint I’ve to accept a MultiPart media file upload from the user which I’m doing like this:

@Path("v3")
public class VBMock{

  @POST
  @Path("/media")
  @Consumes(MediaType.MULTIPART_FORM_DATA)
  @Produces(MediaType.APPLICATION_JSON)
  public Response uploadMedia(@FormDataParam("file") final InputStream uploadedInputStream,
                              @FormDataParam("media") final FormDataContentDisposition fileDetail,
                              @HeaderParam("authorization") final String bearerToken) {

I have an Application class which registers both he VBMock class and the MultipartFeature class as well.

@ApplicationPath("/")
public class ServletApplication extends Application {

  @Override
  public Set<Class<?>> getClasses() {
    final Set<Class<?>> resources = new HashSet<Class<?>>();
    resources.add(VoiceBaseMock.class);
    resources.add(MultiPartFeature.class);
    return resources;
  }
}

But when I deploy this on Weblogic I get the following error regarding unsatisfied dependencies.

WELD-001408 Unsatisfied dependencies for type [Providers] with
qualifiers [@Default] at injection point [[parameter 1] of
[constructor] @Inject public
org.glassfish.jersey.media.multipart.internal.MultiPartReaderServerSide(Providers,
Provider)]:org.jboss.weld.exceptions.DeploymentException:WELD-001408
Unsatisfied dependencies for type [Providers] with qualifiers
[@Default] at injection point [[parameter 1] of [constructor] @Inject
public
org.glassfish.jersey.media.multipart.internal.MultiPartReaderServerSide(Providers,
Provider)]

My pom.xml has the following two dependencies for jersey and jersey-multipart:

<dependency>
  <groupId>org.glassfish.jersey.core</groupId>
  <artifactId>jersey-server</artifactId>
  <version>2.22.1</version>
  <scope>provided</scope>
</dependency>

<dependency>
  <groupId>org.glassfish.jersey.media</groupId>
  <artifactId>jersey-media-multipart</artifactId>
  <version>2.22.1</version>
  <!--<scope>provided</scope>-->
</dependency>

I have registered the MultiPartFeature in web.xml as well:

   <init-param>
      <param-name>jersey.config.server.provider.classnames</param-name>
      <param-value>org.glassfish.jersey.media.multipart.MultiPartFeature</param-value>
    </init-param>

I saw a couple of questions similar to this already on Stackoverflow but I already have everything they were missing. I even checked in the war file that is generated and I can see that the jersey-media-multipart-2.22.1.jar is indeed present in WEB-INF/lib.
So, I’m not sure what is causing this issue here. Suggestions are appreciated.

Answers: