Джерси: «Отсутствует зависимость для метода ...» - PullRequest
4 голосов
/ 21 февраля 2012

Может кто-нибудь объяснить, что означает эта ошибка?

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

Я использую Джерси 1.11 + Jetty 7.6.1.v20120215.Это мои зависимости:

                <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, но не смог найти причину.

Заранее спасибо!

Ответы [ 2 ]

5 голосов
/ 21 февраля 2012

удалить

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

и с тобой все будет в порядке.

Вы путаете Джерси, добавляя связку и отдельные зависимости в путь к классам. Таким образом, в основном у вас есть два класса с одинаковыми именами (в данном случае «com.sun.jersey.core.util.FeaturesAndProperties»), среда выполнения на Джерси ожидает один, а вы предоставляете второй… или наоборот.

В любом случае, вы должны быть в порядке, когда трикотажная связка удалена из classpath.

2 голосов
/ 13 декабря 2012

У меня возникла похожая проблема при работе с несколькими загрузками.После небольшого поиска и исследования я обнаружил, что использую другую версию jarsey-multipart и mimepull jar, которые не совместимы с комплектом jersey, используемым в моем проекте.

Если вы не являетесь разработчиком,убедитесь, что вы добавили следующие jar в ваш путь к классам:

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

X иY - идентификаторы версий для jarsey-multipart и mimepull jar соответственно.

* Обратите внимание, что X (версия jersey-multipart) должна совпадать с версией jar-bundle jar.

...