Discussion:
OAuth errors in "inject.Errors" using Jersey
Corben
2011-07-15 10:09:42 UTC
Permalink
Dear all,

I've started using Jersey to make a REST web service to be protected with oAuth. I'm not an expert in these topics, so any help is really appreciated.

I've followed this tutorial:
http://java.net/projects/jersey/downloads/download/s314285_oauth.zip

Even if I tried to follow it not on the actual exercise, but to modify with Eclipse (instead of NetBeans) an existing Dynamic Web Project that will run on TomCat (instead of Glassfish). Additional information: I'm not using Maven, and I'm modifying an existing and working REST web service using Jersey running on TomCat.

Thanks to the tutorial, I've been able to follow all the steps for the creation of a Service Provider (in the oAuth meaning), and the project compiles properly. However while starting up it gives the following errors:

INFO: Initiating Jersey application, version 'Jersey: 1.8 06/24/2011 12:39 PM'
15-lug-2011 11.41.02 com.sun.jersey.spi.inject.Errors processErrorMessages
GRAVE: The following errors and warnings have been detected with resource and/or provider classes:
  SEVERE: Missing dependency for constructor public com.sun.jersey.oauth.server.api.OAuthServerFilter(com.sun.jersey.api.core.ResourceConfig,com.sun.jersey.oauth.server.spi.OAuthProvider) at parameter index 1
  SEVERE: Missing dependency for field: private com.sun.jersey.oauth.server.api.providers.DefaultOAuthProvider org.eservices4life.tclouds.AuthorizationResource.provider
  SEVERE: Missing dependency for field: private com.sun.jersey.oauth.server.spi.OAuthProvider com.sun.jersey.oauth.server.api.resources.AccessTokenRequest.provider
  SEVERE: Missing dependency for field: private com.sun.jersey.oauth.server.spi.OAuthProvider com.sun.jersey.oauth.server.api.resources.RequestTokenRequest.provider
15-lug-2011 11.41.02 org.apache.catalina.core.StandardContext filterStart
GRAVE: Exception starting filter Jersey Filter
com.sun.jersey.spi.inject.Errors$ErrorMessagesException
    at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170)
    at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136)
    at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:771)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:766)
    at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:488)
    at ...
    ...

At first I tought to a problem of dependencies, but I've tried to include all the possible libraries, without any difference. I've also tried asked a friend to make the war file of the example solution with NetBeans+Glassfish, and extracting the jars from his war, but still no differences.

I'm using Jersey1.8.

I've been struggling with this problem for a couple of days now, and google couldn't really help, so I don't know what else should I try.
Any hint is really welcome!!

Thanks,
Corben
Jakub Podlesak
2011-07-15 14:36:42 UTC
Permalink
Hello Corben,

The tutorial is based on Jersey version 1.4.
Since then, some changes have been made in the OAuth
support area and that is probably the reason of the issues
you are facing. You can check the Jersey change log (see [1],
look at the version 1.7 part).

Given that you have to stick with Eclipse and not using Maven,
then to limit the number of moving parts, i suggest you downgrade
to the Jersey version 1.4 first. Once things work fine for you there,
you may try to upgrade the Jersey version and keep the list posted.

~Jakub

[1]http://java.net/projects/jersey/sources/svn/content/trunk/jersey/changes.txt
Post by Corben
Dear all,
I've started using Jersey to make a REST web service to be protected with oAuth. I'm not an expert in these topics, so any help is really appreciated.
http://java.net/projects/jersey/downloads/download/s314285_oauth.zip
Even if I tried to follow it not on the actual exercise, but to modify with Eclipse (instead of NetBeans) an existing Dynamic Web Project that will run on TomCat (instead of Glassfish). Additional information: I'm not using Maven, and I'm modifying an existing and working REST web service using Jersey running on TomCat.
INFO: Initiating Jersey application, version 'Jersey: 1.8 06/24/2011 12:39 PM'
15-lug-2011 11.41.02 com.sun.jersey.spi.inject.Errors processErrorMessages
SEVERE: Missing dependency for constructor public com.sun.jersey.oauth.server.api.OAuthServerFilter(com.sun.jersey.api.core.ResourceConfig,com.sun.jersey.oauth.server.spi.OAuthProvider) at parameter index 1
SEVERE: Missing dependency for field: private com.sun.jersey.oauth.server.api.providers.DefaultOAuthProvider org.eservices4life.tclouds.AuthorizationResource.provider
SEVERE: Missing dependency for field: private com.sun.jersey.oauth.server.spi.OAuthProvider com.sun.jersey.oauth.server.api.resources.AccessTokenRequest.provider
SEVERE: Missing dependency for field: private com.sun.jersey.oauth.server.spi.OAuthProvider com.sun.jersey.oauth.server.api.resources.RequestTokenRequest.provider
15-lug-2011 11.41.02 org.apache.catalina.core.StandardContext filterStart
GRAVE: Exception starting filter Jersey Filter
com.sun.jersey.spi.inject.Errors$ErrorMessagesException
at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170)
at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:771)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:766)
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:488)
at ...
...
At first I tought to a problem of dependencies, but I've tried to include all the possible libraries, without any difference. I've also tried asked a friend to make the war file of the example solution with NetBeans+Glassfish, and extracting the jars from his war, but still no differences.
I'm using Jersey1.8.
I've been struggling with this problem for a couple of days now, and google couldn't really help, so I don't know what else should I try.
Any hint is really welcome!!
Thanks,
Corben
Martin Matula
2011-07-19 13:53:59 UTC
Permalink
Looks like the OAuth provider implementation is not getting picked up.
Are you using package scanning or some other way of including the
DefaultOAuthProvider in your ResourceConfig?
If you don't understand what I am talking about, please let me know how
your web.xml looks like.
Thanks,
Martin
Post by Corben
Dear all,
I've started using Jersey to make a REST web service to be protected with oAuth. I'm not an expert in these topics, so any help is really appreciated.
http://java.net/projects/jersey/downloads/download/s314285_oauth.zip
Even if I tried to follow it not on the actual exercise, but to modify with Eclipse (instead of NetBeans) an existing Dynamic Web Project that will run on TomCat (instead of Glassfish). Additional information: I'm not using Maven, and I'm modifying an existing and working REST web service using Jersey running on TomCat.
INFO: Initiating Jersey application, version 'Jersey: 1.8 06/24/2011 12:39 PM'
15-lug-2011 11.41.02 com.sun.jersey.spi.inject.Errors processErrorMessages
SEVERE: Missing dependency for constructor public com.sun.jersey.oauth.server.api.OAuthServerFilter(com.sun.jersey.api.core.ResourceConfig,com.sun.jersey.oauth.server.spi.OAuthProvider) at parameter index 1
SEVERE: Missing dependency for field: private com.sun.jersey.oauth.server.api.providers.DefaultOAuthProvider org.eservices4life.tclouds.AuthorizationResource.provider
SEVERE: Missing dependency for field: private com.sun.jersey.oauth.server.spi.OAuthProvider com.sun.jersey.oauth.server.api.resources.AccessTokenRequest.provider
SEVERE: Missing dependency for field: private com.sun.jersey.oauth.server.spi.OAuthProvider com.sun.jersey.oauth.server.api.resources.RequestTokenRequest.provider
15-lug-2011 11.41.02 org.apache.catalina.core.StandardContext filterStart
GRAVE: Exception starting filter Jersey Filter
com.sun.jersey.spi.inject.Errors$ErrorMessagesException
at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170)
at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:771)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:766)
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:488)
at ...
...
At first I tought to a problem of dependencies, but I've tried to include all the possible libraries, without any difference. I've also tried asked a friend to make the war file of the example solution with NetBeans+Glassfish, and extracting the jars from his war, but still no differences.
I'm using Jersey1.8.
I've been struggling with this problem for a couple of days now, and google couldn't really help, so I don't know what else should I try.
Any hint is really welcome!!
Thanks,
Corben
Loading...