Arun Thirupathi
2017-06-13 18:21:00 UTC
In one of our projects we are binding an implementation in RequestScope.
But when this is run from a background thread, it fails with the exception
below.
Error in custom provider, com.google.inject.OutOfScopeException: Cannot
access scoped object.
Either we are not currently inside an HTTP Servlet request, or you may have
forgotten to apply
com.google.inject.servlet.GuiceFilter as a servlet filter for this request.
Can I bind different implementations based on the scope ? I want to provide
one implementation in RequestScope and other implementation in another
scope.
Is there a way to configure Guice to ignore these errors silently.
Currently I am thinking of the naive way of, try/catch all the usage of
this object, which is far too many and there are new interactions with this
object.
I run my project inside Google App Engine, if that matters.
Thanks,
Arun.
But when this is run from a background thread, it fails with the exception
below.
Error in custom provider, com.google.inject.OutOfScopeException: Cannot
access scoped object.
Either we are not currently inside an HTTP Servlet request, or you may have
forgotten to apply
com.google.inject.servlet.GuiceFilter as a servlet filter for this request.
Can I bind different implementations based on the scope ? I want to provide
one implementation in RequestScope and other implementation in another
scope.
Is there a way to configure Guice to ignore these errors silently.
Currently I am thinking of the naive way of, try/catch all the usage of
this object, which is far too many and there are new interactions with this
object.
I run my project inside Google App Engine, if that matters.
Thanks,
Arun.
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice+***@googlegroups.com.
To post to this group, send email to google-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/2238b96f-0b42-408b-8bbb-08d58f3a0d1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice+***@googlegroups.com.
To post to this group, send email to google-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/2238b96f-0b42-408b-8bbb-08d58f3a0d1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.