xiaodududu / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 0 forks source link

Struts2 plug-in fails with custom type converters #611

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm running into a problem whereby the Guice/Struts2 plug-in fails to 
initialize properly when there are custom type converters defined in 
xwork-conversion.properties.

The problem appears to be that Struts2 initializes type converters before 
interceptors (this is done in XWorkConverter). Without the type converters 
defined, buildInterceptor is called first for each interceptor, so that when 
buildBean is finally called it properly creates the child injector. With type 
converters, buildBean is called prior to the calls to buildInterceptor, 
creating the child injector without the interceptors registered and resulting 
in a NullPointerException when attempting to invoke an action.

I have created a small test app that shows this problem. Running the app should 
illustrate the problem as soon as you attempt to invoke the action called 
"test". If you comment out the entry in xwork-conversion.properties, the app 
runs as expected.

I'm running the test app under Tomcat 6.

Original issue reported on code.google.com by steven.b...@gmail.com on 4 Mar 2011 at 4:51

Attachments:

GoogleCodeExporter commented 9 years ago
Re-attaching the file. The original was unnecessarily large due to not deleting 
the target directory before zipping.

Original comment by steven.b...@gmail.com on 4 Mar 2011 at 4:54

Attachments:

GoogleCodeExporter commented 9 years ago
Can you test this out with 3.0rc2?  It contains some changes to the struts2 
plugin.

Original comment by sberlin on 4 Mar 2011 at 2:22

GoogleCodeExporter commented 9 years ago
Hi, sberlin: This was tested with 3.0rc2 (both guice and the struts2 plug-in).

Original comment by steven.b...@gmail.com on 4 Mar 2011 at 5:05

GoogleCodeExporter commented 9 years ago

Original comment by sberlin on 5 Mar 2011 at 2:50