javajerseywarnings

Jersey: "Falling back to injection-less client"


I'm bumping the dependencies I have on an old test harness to the latest versions. One of these dependencies is jersey-client which I've bumped to 3.1.6, which at the time of writing this is the last released version.

When I run the code I get the following warning in the application logs:

org.glassfish.jersey.client.innate.inject.NonInjectionManager <init>
WARNING: Falling back to injection-less client.

This message is written every time I make a REST call irrespective of the type of call (GET, PUT, POST, DELETE etc)

Clearly jersey is trying to tell me something it considers important, but it's not obvious what the problem is or what I should do about it. I've tried searching the warning message for some documentation on the issue; one search engine only drew up 6 hits (none of which where helpful), another failed to find any hits at all.

Apart from flooding the logs with unwanted messages (one for each call I make), my application appears to be working so there is no immediate problem. All the same, I'd still like to know what the problem is as it's almost always a bad idea to ignore warning messages.

Does anybody know what this message is referring to or how to fix it?


Solution

  • I also think that the behaviour is poorly documented, but it seems that jersey would like to use an injection factory. After adding jersey's injection manager

            <dependency>
                <groupId>org.glassfish.jersey.inject</groupId>
                <artifactId>jersey-hk2</artifactId>
            </dependency>
    

    as dependency, the message disappeared.

    I don't know what exactly the advantage is, but maybe you can integrate jersey configurations or, for example, a logging filter via injection.