Fixing SEVERE errors with Jersey on WebApp startup

The problem

As some background, I’m running the following:

The specific error that we’re going to fix is:

SEVERE: The following errors and warnings have been detected with resource and/or provider classes:
SEVERE: Missing dependency for method public at parameter at index 0
SEVERE: Method, public, annotated with GET of resource, class, is not recognized as valid resource method.

If you’re running Tomcat like I am then you’ll see this in your catalina.out log file.

The fix

Your request object, that is the parameter to the method that’s mentioned in the error ( in the example), needs a valueOf method added. Something like this:


  public static YourRequest valueOf(String reqJson) {
    ObjectMapper mapper = new ObjectMapper();
    try {
      return mapper.readValue(reqJson, YourRequest.class);
    } catch (Exception e) {
      throw new RuntimeException(e);

comments powered by Disqus