users@jersey.java.net

[Jersey] No OAuthProvider implementation found in the list of providers.

From: <azadbolour_at_bolour.com>
Date: Thu, 7 Apr 2011 01:22:45 +0000 (GMT)

I have a JUnit test that starts a Jetty server for serving a hello
world
resource (source of test included below).

When I add the OAuth (1.6) server jar file to the classpath for this
test case
without using OAuth anywhere the server reports the following
exceptions:

SEVERE: The provider class, class
com.sun.jersey.oauth.server.OAuthProviderInjectionProvider, \
could not be instantiated. Processing will continue but the class will
not be utilized
java.lang.RuntimeException: No OAuthProvider implementation found in
the list of providers.
        at
com.sun.jersey.oauth.server.OAuthProviderInjectionProvider.<init>(OAuth
ProviderInjectionProvider.java:71)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

[Full server output below.]

The exception seems harmless. I can extend the test case to use OAuth
in the
client and the server OK. But naturally it bugs us to see the exception
on each
test run. And I have not been able to figure out how to avoid it.

Do I need further configuration and setup of the jersey servlet
container to
avoid this?

Many thanks.

Azad


The test case:

public class TrialTest extends TestCase
{
    public void testStartServer() throws Exception
    {
        Server instance = new Server(8181);
        ServletContextHandler context = new
ServletContextHandler(ServletContextHandler.SESSIONS);
        context.setContextPath("/services");
        instance.setHandler(context);
        Servlet servlet = new
com.sun.jersey.spi.container.servlet.ServletContainer();
        ServletHolder servletHolder = new ServletHolder(servlet);
        Map<String, String> initParameters = new HashMap<String,
String>();
        initParameters.put("com.sun.jersey.config.property.packages",
HelloWorldResource.class.getPackage().getName());
        servletHolder.setInitParameters(initParameters);
        context.addServlet(servletHolder, "/rest/*");
        instance.start();
    }
}

The server output:

2011-04-07 00:30:11.433:INFO::Logging to StdErrLog::DEBUG=false via
org.eclipse.jetty.util.log.StdErrLog
2011-04-07 00:30:11.488:INFO::jetty-7.0.2.v20100331
Apr 7, 2011 12:30:11 AM com.sun.jersey.api.core.PackagesResourceConfig
init
INFO: Scanning for root resource and provider classes in the packages:
  com.bolour.trial.jersey.resources
Apr 7, 2011 12:30:11 AM com.sun.jersey.api.core.ScanningResourceConfig
logClasses
INFO: Root resource classes found:
  class com.bolour.trial.jersey.resources.HelloWorldResource
Apr 7, 2011 12:30:11 AM com.sun.jersey.api.core.ScanningResourceConfig
init
INFO: No provider classes found.
Apr 7, 2011 12:30:11 AM
com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.6-SNAPSHOT
03/24/2011 01:01 PM'
Apr 7, 2011 12:30:11 AM
com.sun.jersey.core.spi.component.ProviderFactory
__getComponentProvider
SEVERE: The provider class, class
com.sun.jersey.oauth.server.OAuthProviderInjectionProvider, could not
be instantiated. Processing will continue but
the class will not be utilized
java.lang.RuntimeException: No OAuthProvider implementation found in
the list of providers.
        at
com.sun.jersey.oauth.server.OAuthProviderInjectionProvider.<init>(OAuth
ProviderInjectionProvider.java:71)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructor
AccessorImpl.java:39)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCon
structorAccessorImpl.java:27)
        at
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at
com.sun.jersey.core.spi.component.ComponentConstructor._getInstance(Com
ponentConstructor.java:198)
        at
com.sun.jersey.core.spi.component.ComponentConstructor.getInstance(Comp
onentConstructor.java:169)
        at
com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvide
r(ProviderFactory.java:166)
        at
com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(
ProviderFactory.java:137)
        at
com.sun.jersey.core.spi.component.ProviderServices.getComponent(Provide
rServices.java:256)
        at
com.sun.jersey.core.spi.component.ProviderServices.getProvidersAndServi
ces(ProviderServices.java:205)
        at
com.sun.jersey.core.spi.factory.InjectableProviderFactory.configure(Inj
ectableProviderFactory.java:106)
        at
com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(Web
ApplicationImpl.java:1017)
        at
com.sun.jersey.server.impl.application.WebApplicationImpl.access$600(We
bApplicationImpl.java:159)
        at
com.sun.jersey.server.impl.application.WebApplicationImpl$12.f(WebAppli
cationImpl.java:693)
        at
com.sun.jersey.server.impl.application.WebApplicationImpl$12.f(WebAppli
cationImpl.java:690)
        at
com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
        at
com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebA
pplicationImpl.java:690)
        at
com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebA
pplicationImpl.java:685)
        at
com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletC
ontainer.java:488)
        at
com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebCompon
ent.initiate(ServletContainer.java:318)
        at
com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.jav
a:601)
        at
com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.jav
a:208)
        at
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletConta
iner.java:373)
        at
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletConta
iner.java:556)
        at javax.servlet.GenericServlet.init(GenericServlet.java:212)
        at
org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:
421)
        at
org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:245)
        at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCy
cle.java:55)
        at
org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java
:694)
        at
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletCon
textHandler.java:193)
        at
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.
java:586)
        at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCy
cle.java:55)
        at
org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.
java:92)
        at org.eclipse.jetty.server.Server.doStart(Server.java:230)
        at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCy
cle.java:55)
        at
com.bolour.trial.jersey.TrialTest.testStartServer(TrialTest.java:30)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
va:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
rImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at junit.framework.TestCase.runTest(TestCase.java:164)
        at junit.framework.TestCase.runBare(TestCase.java:130)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:120)
        at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JU
nit3TestReference.java:130)
        at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.j
ava:38)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteT
estRunner.java:467)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteT
estRunner.java:683)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRu
nner.java:390)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestR
unner.java:197)
2011-04-07 00:30:12.272:INFO::Started
SelectChannelConnector_at_0.0.0.0:8181