I've been trying to use a custom ServletModule together with a struts
2 object factory without any luck.
This is my servletmodule:
public class GuiceServletModule extends ServletModule {
@Override
protected void configureServlets() {
//configure which urls should be handled by struts:
Map<String, String> strutsParams = new HashMap<String,
String>();
strutsParams.put("actionPackages", BaseAction.class.getPackage
().getName());
filter("/start", "/program/*",)
.through(StrutsPrepareAndExecuteFilter.class,
strutsParams);
//configure GWT RPC services:
serve("/gwt/program").with(ProgramServiceImpl.class);
serve("/gwt/user").with(UserServiceImpl.class);
}
}
In struts.xml, I have this:
<constant name="struts.objectFactory" value="guice" />
In web.xml, I have this:
<listener>
<!-- Initializer for guice -->
<listener-class>com.kanal5.play.guice.GuiceServletConfig</listener-
class>
</listener>
...which is implemented by this class...
public class GuiceServletConfig extends GuiceServletContextListener {
@Override
protected Injector getInjector() {
return Guice.createInjector(new GuiceServletModule());
}
}
This is the error I get:
WARNING: Multiple injectors detected. Please install only one
ServletModule in your web application. While you may have more than
one injector, you should only configure guice-servlet in one of them.
(Hint: look for legacy ServetModules or multiple calls to
Servlets.configure()).
The problem seem to be related to the problem described in this thread
(but I couldn't figure out what they did to make it work):
http://groups.google.com/group/google-guice/browse_thread/thread/b0df62e0e61764/7b72c3a60c734653
I'm using guice 2.0
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---