Open GoogleCodeExporter opened 9 years ago
Are you using the latest SVN head of guice & guice-servlet? I believe it
supports multiple injectors in the same JVM (whereas the version shipped with
2.0 did not).
Original comment by sberlin
on 19 Oct 2010 at 10:32
[deleted comment]
yes, lastest SVN.
doFilter method in GuiceFilter is using
FilterPipeline filterPipeline = null != injectedPipeline ? injectedPipeline :
pipeline;
but injectedPipeline is null, because it is not injected. I am getting
MULTIPLE_INJECTORS_WARNING message in log, and previously store pipeline (which
is static) is overwritten.
Original comment by stra...@gmail.com
on 19 Oct 2010 at 10:44
Here is simple scenario:
ear
-APP-INF/lib/guice*.jar
-war1
-/servlet1
-war2
-/servlet2
both war1 and war2 have in its own web.xml defined GuiceFilter and class which
extends GuiceServletContextListener to define injector.
So even GuiceFilter is defined as a Singleton, two instances are created (one
for war1 and one for war2) by container (so they are not injected).
In this case, both instances shares same static servletcontext and same static
pipeline.
The simplest solution should be imho injecting members in GuiceFilter in init
method before pipelines are initialized.
Or maybe I am using it wrong way...
Original comment by stra...@gmail.com
on 21 Oct 2010 at 1:46
This is because you're placing it in the common classloader--you need to place
it in the webapp classloader instead (WEB-INF rather than APP-INF). This is by
deliberate design in Guice.
Original comment by dha...@gmail.com
on 21 Oct 2010 at 11:17
To clarify, you should place a copy of guice-servlet-*.jar in each WEB-INF/lib
directory of your app.
You can share all the other guice-*.jars however (in APP-INF/lib), should you
so desire.
Original comment by dha...@gmail.com
on 21 Oct 2010 at 11:19
If you use Jersey, you have to place both guice-servlet-*.jar and jersey-guice
, otherwise...you get this multibings issue.
Iker.
Original comment by iker.ola...@gmail.com
on 7 May 2014 at 1:30
Original issue reported on code.google.com by
stra...@gmail.com
on 19 Oct 2010 at 10:25