3

I have the following JAX-RS method signature:

void searchSignatureService(@QueryParam("from") ZonedDateTime from, @QueryParam("to") ZonedDateTime to, @HeaderParam("If-None-Match") String if_None_Match, @HeaderParam("Authorization") String authorization, 
            @HeaderParam("Accept") String accept, @Suspended AsyncResponse async);

When I try and hit this with a web browser, I get the exception as follows:

[[FATAL] No injection source found for a parameter of type public void com.example.jaxrs.service.signature.SignatureResource.searchSignatureService(java.time.ZonedDateTime,java.time.ZonedDateTime,java.lang.String,java.lang.String,java.lang.String,javax.ws.rs.container.AsyncResponse) at index 0.; source='ResourceMethod{httpMethod=GET, consumedTypes=[], producedTypes=[application/xml, application/json], suspended=true, suspendTimeout=0, suspendTimeoutUnit=MILLISECONDS, invocable=Invocable{handler=ClassBasedMethodHandler{handlerClass=class com.example.jaxrs.service.signature.SignatureResource, handlerConstructors=[org.glassfish.jersey.server.model.HandlerConstructor@588562ac]}, definitionMethod=public abstract void com.example.jaxrs.api.SignatureResource.searchSignatureService(java.time.ZonedDateTime,java.time.ZonedDateTime,java.lang.String,java.lang.String,java.lang.String,javax.ws.rs.container.AsyncResponse), parameters=[Parameter [type=class java.time.ZonedDateTime, source=from, defaultValue=null], Parameter [type=class java.time.ZonedDateTime, source=to, defaultValue=null], Parameter [type=class java.lang.String, source=If-None-Match, defaultValue=null], Parameter [type=class java.lang.String, source=Authorization, defaultValue=null], Parameter [type=class java.lang.String, source=Accept, defaultValue=null], Parameter [type=interface javax.ws.rs.container.AsyncResponse, source=javax.ws.rs.container.Suspended, defaultValue=null]], responseType=void}, nameBindings=[]}']

Given that the exception started when I tried to convert java.util.Date to java.time.ZonedDateTime, I am assuming that the "injection source" has something to do with mapping the date string to java.time.ZonedDateTime.

Is there a missing dependency that I need to make the java.time package work with jersey?

My current dependencies are as follows:

<dependency>
  <groupId>org.glassfish.jersey.containers</groupId>
  <artifactId>jersey-container-servlet</artifactId>
  <version>2.27</version>
</dependency>
<dependency>
  <groupId>org.glassfish.jersey.media</groupId>
  <artifactId>jersey-media-moxy</artifactId>
  <version>2.27</version>
</dependency>
<dependency>
  <groupId>org.glassfish.jersey.bundles</groupId>
  <artifactId>jaxrs-ri</artifactId>
  <version>2.27</version>
</dependency>
Graham Leggett
  • 911
  • 7
  • 20

0 Answers0