I had a similar problem. When you're running with the new plugin, you can't set the guice.module property. comment that line on your .properties or XML and it would work.
For unit tests i use the old plugin, since with the new one I got a NPE because i'm not creating the Servlet Context, just the Dispatcher. For doing that, conserve the old object factory creating another bean on struts-plugin.xml: <bean type="com.opensymphony.xwork2.ObjectFactory" name="guice" class="com.google.inject.servlet.Struts2Factory"/> <bean type="com.opensymphony.xwork2.ObjectFactory" name="guice-test" class="com.google.inject.struts2.GuiceObjectFactory"/> and switch your .properties when you start the Dispatcher, something like this: HashMap<String, String> params = new HashMap<String, String>(); // Override struts.xml config constants to use a guice test module params.put("struts.objectFactory", "guice-test"); params.put("guice.module", "com.eventuo.guice.StrutsTestCaseModule"); servletContext = new MockServletContext(); dispatcher = new Dispatcher(servletContext, params); dispatcher.init(); hope this helps! jordi On Mon, Jun 29, 2009 at 4:28 PM, Greg Lindholm <greg.lindh...@gmail.com>wrote: > Is there any documentation for using this new Struts2 plugin? > > I see from the source that: > > "The struts2 plugin no longer supports specifying a module" > + "via the 'guice.module' property in XML." > + " Please install your module via a GuiceServletContextListener > instead." > > This is unfortunate because I use this facility to swap in a test module > when running unit tests. I create a Dispatcher and pass it the guice.module > parameter to override the struts.xml value. > > Have you thought about how to unit test with this new plugin and how to > provide a test module? Could you please include a note about this with the > documentation. > > > ---------- Forwarded message ---------- > From: <codesite-nore...@google.com> > Date: Fri, Jun 26, 2009 at 9:02 PM > Subject: Issue 396 in google-guice: Struts2 plugin NPE if server bounced > To: greg.lindh...@gmail.com > > > Updates: > Status: Fixed > > Comment #1 on issue 396 by dhanji: Struts2 plugin NPE if server bounced > http://code.google.com/p/google-guice/issues/detail?id=396 > > Thanks for reporting this! > > Btw, note that I've rewritten the struts2 plugin altogether (it now works > properly with Guice Servlet2 and it > doesn't do evil things like catch Throwable). But I have made the fix in > both versions of the plugin. > > -- > You received this message because you are listed in the owner > or CC fields of this issue, or because you starred this issue. > You may adjust your issue notification preferences at: > http://code.google.com/hosting/settings > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to google-guice@googlegroups.com To unsubscribe from this group, send email to google-guice+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-guice?hl=en -~----------~----~----~----~------~----~------~--~---