Closed psvanstrom closed 8 years ago
I did also encounter this kind of issue and its really annoying. Is there something that can be done about this? Why does the GuiceBundle force the HK2 ServiceLocator?
I'm facing this issue too.
I'm facing this issue too. I'm also wondering if this is the cause for other problem I'm having:
com.google.inject.OutOfScopeException: Cannot access scoped [javax.servlet.http.HttpServletRequest]
Both only appeared after upgrading to dropwizard 1.0.0 and dropwizard-guice 1.0.0.1
+1
+1
I'm not sure how if there's a robust way to avoid this. Looking at the jersey2-guice code, it seems like it logs this warning when the first ServiceLocatorGenerator
returned from the ServiceLoader
isn't an instance of GuiceServiceLocatorGeneratorStub
. In this case, it seems to be an instance of ServiceLocatorGeneratorImpl
from the hk2-locator artifact. I tried excluding that artifact but that doesn't work because JerseyGuiceUtils
references other hk2-locator classes directly so I get a ClassNotFoundException
. I was able to sort of hack around this problem in my test application by moving the jersey2-guice-impl dependency to the front of the list, which made the warning stop printing. Can anyone experiencing this issue try running your app against this commit to see if it fixes it for you as well? If so, I'll cut a release with this change
@jhaber,
You're talking about this commit right? 5b2e3357fc23e368ec9e3b6a484147e7196b0ef7
Cheers
Yep
Can anyone experiencing this issue try running your app against this commit to see if it fixes it for you as well?
Confirm. Thank you for the effort!
Yup, it fixes it. Thank you 👍
Thanks for confirmation, I just released this change as part of version 1.0.0.2 which should show up in Maven central soon
I'm currently experiencing this issue on dropwizard-guice 1.0.0.2.
I am seeing this with DropWizard 1.3.1. We had to downgrade HK2 because injection to @BeanParam stopped working.
I'm seeing this with dropwizard-guice 1.0.6.0
I'm getting a WARN in my log at startup:
Is this to be expected? I can see that the
GuiceBundle.java
explicitly loads the HK2 ServiceLocator which is what makes theJerseyGuiceUtils
complain:https://github.com/HubSpot/dropwizard-guice/blob/master/src/main/java/com/hubspot/dropwizard/guice/GuiceBundle.java#L104-L111
Everything seems to work alright but still it's a bit annoying having a WARN in the startup log so I just to make sure that this is ok?