users@jersey.java.net

Missing dependency for constructor

From: Jared Nedzel <jnedzel_at_broadinstitute.org>
Date: Tue, 10 Aug 2010 13:42:59 -0400

I'm porting some code that works on jersey 1.0.3.1 to jersey 1.3.

When I run it using jersey 1.3, it fails with the following stack trace:

Aug 10, 2010 1:31:48 PM org.genomespace.util.server.Main startServer
INFO: starting grizzly...
Aug 10, 2010 1:31:49 PM com.sun.grizzly.Controller logVersion
INFO: Starting Grizzly Framework 1.9.18-i - Tue Aug 10 13:31:49 EDT 2010
Aug 10, 2010 1:31:49 PM org.genomespace.util.server.Main startServer
INFO: grizzly started
Aug 10, 2010 1:31:49 PM org.genomespace.util.server.Main main
INFO: server running at https://localhost:8444/; hit return to stop
Aug 10, 2010 1:31:57 PM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
   org.genomespace.system
Aug 10, 2010 1:31:57 PM com.sun.jersey.api.core.ScanningResourceConfig
logClasses
INFO: Root resource classes found:
   class org.genomespace.system.jerseytest.UserResource
Aug 10, 2010 1:31:57 PM com.sun.jersey.api.core.ScanningResourceConfig
logClasses
INFO: Provider classes found:
   class org.genomespace.system.messaging.handler.SecurityFilter
   class org.genomespace.system.messaging.handler.AuthenticationException
Aug 10, 2010 1:31:57 PM
com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.3 06/17/2010
04:53 PM'
Aug 10, 2010 1:31:57 PM 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 constructor public
org.genomespace.system.messaging.handler.AuthenticationException(java.lang.String)
at parameter index 0
Aug 10, 2010 1:31:57 PM com.sun.grizzly.http.servlet.ServletAdapter
doService
SEVERE: service exception:
com.sun.jersey.spi.inject.Errors$ErrorMessagesException
     at
com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:150)
     at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:117)
     at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:183)
     at
com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:649)
     at
com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:644)
     at
com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:428)
     at
com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:277)
     at
com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:573)
     at
com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:211)
     at
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:332)
     at
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:496)
     at javax.servlet.GenericServlet.init(GenericServlet.java:241)
     at
com.sun.grizzly.http.servlet.ServletAdapter.loadServlet(ServletAdapter.java:428)
     at
com.sun.grizzly.http.servlet.ServletAdapter.doService(ServletAdapter.java:367)
     at
com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:324)
     at
com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
     at
com.sun.grizzly.tcp.http11.GrizzlyAdapterChain.service(GrizzlyAdapterChain.java:180)
     at
com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
     at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
     at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
     at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
     at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
     at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
     at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
     at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
     at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
     at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
     at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
     at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
     at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
     at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
     at java.lang.Thread.run(Thread.java:637)

The code in question is as follows:

package org.genomespace.system.messaging.handler;

import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

@Provider
public class AuthenticationException extends Exception
     implements ExceptionMapper<AuthenticationException> {

     public AuthenticationException(String message) {super(message);}

     public AuthenticationException(String message, Throwable cause) {

     }

     @Override
     public Response toResponse(AuthenticationException e) {
         return Response.status(Status.UNAUTHORIZED)
             .header("WWW-Authenticate",
                     "X-GSToken realm=\"GenomeSpace Server\"")
             .type("text/plain").entity(e.getMessage()).build();
     }
}

Any ideas?

Thanks,

Jared Nedzel
Broad Institute