Jersey: "There is no dependence on the method ..."

Can someone 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 to look around Google, but I could not find the reason.

Thanks in advance!

+4
source share
2 answers

remove

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

and everything should be fine.

You confuse Jersey by adding a bunch and separate dependencies to the class path. So basically you have two classes that have the same name ("com.sun.jersey.core.util.FeaturesAndProperties" in this case), Jersey runtime expects one, and you provide the second ... or vice versa.

In any case, you should be fine when the jersey-bundle is removed from the class path.

+5
source

I had a similar problem when working with multi-page downloads. After searching and investigating the bit, I realized that I used different versions of jersey-multipart and mimepull jars, which were not compatible with the jersey kit used in my project.

If you are a non-maven developer, make sure you add the following jars to your classpath:

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

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

* Please note that X (jersey-multipart version) must be the same as the jersey-bundle jar version.

+2
source

Source: https://habr.com/ru/post/1397526/


All Articles