jersey icon indicating copy to clipboard operation
jersey copied to clipboard

Registering resources in ResourceConfig leads to warnings

Open silvestre opened this issue 8 years ago • 7 comments

Hi,

we register Resources using the ResourceConfig.register(Object object) method. This works and has worked until now. However now (2.26) we are getting a warning:

Oct 17, 2017 1:47:00 PM org.glassfish.jersey.internal.inject.Providers checkProviderRuntime WARNING: A provider war.HelloWorldResource registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime. Due to constraint configuration problems the provider war.HelloWorldResource will be ignored.

It looks like the check assumes that no resources are registered in this way. Is this a bug or are we misusing the ResourceConfig API?

I've attached a minimal reproducing case based on the jersey-example-java8-webapp archetype. Running war.App leads to the warning above.

Thanks & best regards, Silvestre

silvestre avatar Oct 17 '17 11:10 silvestre

Same issue after updating from jersey 2.25.1 to 2.26.

@jansupol does your "question" label imply that this is not a bug but the expected behaviour? Could you explain?

retog avatar Jan 25 '18 20:01 retog

Jersey started to provide more warnings lately, so it is possible that users can see more warnings than in the previous versions. The question in the issue description suggested you did not feel strongly about the issue, but if you now feel this is positively a bug, I am happy to change the label for you.

jansupol avatar Jan 25 '18 21:01 jansupol

I agree with Silvestre. I find it a huge plus of Jersey that it allows for manual dependency injection. I also would like the warning to go away if possible please.

unclejamal avatar Jan 29 '18 13:01 unclejamal

Has anyone found a workaround for this?

electrum avatar Mar 20 '18 15:03 electrum

Question: from the text it is not clear to me whether this is just a warning - or whether things actually break. Which is it?

jvissers avatar Apr 05 '18 00:04 jvissers

@jvissers it is just a warning. For me its a reason to stay with the older version as I don't want to clutter the output with this pointless warnings. @electrum, you could try to hack into the logger or use Java.lang.System.setErr() to specifically suppress these warnings.

retog avatar Apr 05 '18 08:04 retog

If you want to stop it showing the messages you can set in your logger settings org.glassfish.jersey.internal.inject.Providers=SEVERE to stop it appearing

Cousjava avatar Apr 05 '18 08:04 Cousjava