Jersey: "Missing dependency for method ..."

10,821

Solution 1

remove

   <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-bundle</artifactId>
        <version>1.11</version>
   </dependency>

and you should be fine.

You are confusing Jersey by adding bundle and separate dependencies to the classpath. So basically you have two classes which have same name ("com.sun.jersey.core.util.FeaturesAndProperties" in this case), Jersey runtime expects one and you are providing second one.. or vice versa.

Anyway, you should be fine when jersey-bundle is removed from classpath.

Solution 2

I had experienced similar issue while dealing with multipart uploads. After bit searching and investigation, I figured out that I was using different version of jersey-multipart and mimepull jars which were not compatible with the jersey bundle used in my project.

If you are a non-maven developer, make sure that you have added following jars in your classpath:

  • jersey-multipart-X.jar
  • mimepull-Y.jar

X and Y are version identifiers for jersey-multipart and mimepull jars respectively.

*Note that X (version of jersey-multipart) should be same as the version of jersey-bundle jar.

Share:
10,821

Related videos on Youtube

carlspring
Author by

carlspring

I am a Senior Build, Release and Deployment Engineering contractor (with some seven years in the field). I am also a Senior Java Developer (with well over ten years behind me). I am into source control management, tooling, continuous integration, research and development and other odd things most developers wouldn't want to get into. :) I am active in the Open Source community, by hosting several of my own projects, as well as discussing or contributing fixes for various OSS projects. I believe in OSS and that contributing to the online society via either free tools or advice on various problems will not only strengthen one's own knowledge, but also help others advance as well.

Updated on June 04, 2022

Comments

  • carlspring
    carlspring about 2 years

    Could somebody please explain the meaning of this error?

    INFO: Scanning for root resource and provider classes in the Web app resource paths:
      /WEB-INF/lib
      /WEB-INF/classes
    Feb 21, 2012 3:03:48 AM com.sun.jersey.api.core.ScanningResourceConfig logClasses
    INFO: Root resource classes found:
      class com.foo.dom2jcr.rest.XMLCRUDRestlet
    Feb 21, 2012 3:03:48 AM com.sun.jersey.api.core.ScanningResourceConfig init
    INFO: No provider classes found.
    Feb 21, 2012 3:03:48 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
    INFO: Initiating Jersey application, version 'Jersey: 1.11 12/09/2011 10:27 AM'
    Feb 21, 2012 3:03:49 AM com.sun.jersey.spi.inject.Errors processErrorMessages
    SEVERE: The following errors and warnings have been detected with resource and/or provider classes:
      SEVERE: Missing dependency for method public void com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider.setConfiguration(com.sun.jersey.core.util.FeaturesAndProperties) at parameter at index 0
      SEVERE: Missing dependency for method public void com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.setConfiguration(com.sun.jersey.core.util.FeaturesAndProperties) at parameter at index 0
      SEVERE: Missing dependency for method public void com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.setConfiguration(com.sun.jersey.core.util.FeaturesAndProperties) at parameter at index 0
      SEVERE: Missing dependency for method public void com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider.setConfiguration(com.sun.jersey.core.util.FeaturesAndProperties) at parameter at index 0
      SEVERE: Missing dependency for method public void com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider.setConfiguration(com.sun.jersey.core.util.FeaturesAndProperties) at parameter at index 0
      SEVERE: Missing dependency for method public void com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider.setConfiguration(com.sun.jersey.core.util.FeaturesAndProperties) at parameter at index 0
      SEVERE: Missing dependency for method public void com.sun.jersey.json.impl.provider.entity.JSONListElementProvider.setConfiguration(com.sun.jersey.core.util.FeaturesAndProperties) at parameter at index 0
      SEVERE: Missing dependency for method public void com.sun.jersey.json.impl.provider.entity.JSONListElementProvider.setConfiguration(com.sun.jersey.core.util.FeaturesAndProperties) at parameter at index 0
      SEVERE: Missing dependency for method public void com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.setConfiguration(com.sun.jersey.core.util.FeaturesAndProperties) at parameter at index 0
    [INFO] Started Jetty Server
    

    I am using Jersey 1.11 + Jetty 7.6.1.v20120215. These are my dependencies:

                    <dependency>
                        <groupId>com.sun.jersey</groupId>
                        <artifactId>jersey-bundle</artifactId>
                        <version>1.11</version>
                    </dependency>
                    <dependency>
                        <groupId>com.sun.jersey</groupId>
                        <artifactId>jersey-client</artifactId>
                        <version>1.11</version>
                    </dependency>
                    <dependency>
                        <groupId>com.sun.jersey</groupId>
                        <artifactId>jersey-servlet</artifactId>
                        <version>1.11</version>
                    </dependency>
                    <dependency>
                       <groupId>com.sun.jersey.contribs</groupId>
                       <artifactId>jersey-multipart</artifactId>
                       <version>1.11</version>
                    </dependency>
    

    I tried looking around Google, but I couldn't seem to find the cause.

    Thanks in advance!