Can you create an issue on the tracker with the fix & a test (that
previously would have failed, but now passes)?

sam

On Tue, Mar 22, 2011 at 3:12 PM, Jeff Butler <[email protected]> wrote:

> I've been struggling to get my Struts2+SiteMesh+Guice application
> working.  I was getting this stack trace with guice 3.0 rc3 and Struts
> 2.2.1.1:
>
>
> java.lang.NullPointerException
>        com.google.inject.struts2.Struts2Factory
> $ProvidedInterceptor.intercept(Struts2Factory.java:215)
>
>
> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
> 248)
>
> org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:
> 52)
>
> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:
> 485)
>
>
> org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:
> 77)
>
>
> org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter.doFilter(StrutsExecuteFilter.java:
> 88)
>
> com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:
> 162)
>
>
> com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:
> 58)
>
>
> com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:
> 129)
>
>
> com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:
> 77)
>
> com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:
> 162)
>
>
> com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:
> 58)
>
>
> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter.doFilter(StrutsPrepareFilter.java:
> 82)
>
> com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:
> 162)
>
>
> com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:
> 58)
>
>
> com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:
> 118)
>        com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
>
> I did a little investigation and found that Struts is calling
> StrutsFactory.buildInterceptor() AFTER Struts2Factory.createInjector()
> is called.  This means that the created interceptor never has its
> inject() method called, the created interceptor is added to the list
> of provided interceptors AFTER the initialize loop in the
> buildInterceptor() method.
>
> To fix this, I added the line "providedInterceptor.inject()" to the
> end of the buildInterceptor() method and all seems to be working fine.
>
> So, is this a bug, or do I have something configured wrong?
>
> Thanks!
> Jeff Butler
>
> --
> 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.
>
>

-- 
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.

Reply via email to