泽西岛:“缺少方法的依赖性..."; [英] Jersey: "Missing dependency for method ..."

查看:104
本文介绍了泽西岛:“缺少方法的依赖性...";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释这个错误的含义吗?

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

我正在使用Jersey 1.11 + Jetty 7.6.1.v20120215. 这些是我的依赖项:

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>

我尝试环顾Google,但似乎找不到原因.

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

提前谢谢!

推荐答案

删除

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

你应该没事.

通过将捆绑包和单独的依赖项添加到类路径中,使Jersey感到困惑.因此,基本上,您有两个具有相同名称的类(在本例中为"com.sun.jersey.core.util.FeaturesAndProperties"),Jersey运行时期望一个,而您要提供第二个.反之亦然.

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.

无论如何,当从类路径中删除jersey-bundle时,您应该没事.

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

这篇关于泽西岛:“缺少方法的依赖性...";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆