|
|
|
I'd like to create a patch on WebWork but that Jalopy crap has caused some files on my machine to be styled, and others on the CVS server to be styled. It's a mess now and I can't create a decent patch. The WebWork changes were pretty straight-forward.
I did include a ContextListener to bootstrap the SpringObjectFactory configuration in WebWork, so I have attached that file. BTW, using Spring as an object factory rocks. From what Chris Nokelberg said, this sounds like it's actually a Spring bug... Should we close it and let them fix it? I'm not big on making XWork more complicated to work around optional libraries bugs...
I guess as the designers, you guys will have to make that decision. I think Chris was indicating that this isn't expected behavior from CGLIB's caching mechanism. I'm not so sure it is a Spring mistake.
I guess the true "architecture" question, is whether XWork should choose to implement the invoker in a manner that can allow a third-party library to produce an unchecked exception. The recent (welcome) addition of an external ObjectFactory requires that the ObjectFactory play by certain rules at this point. If not fixed, they should at least be documented. Regardless of whether this bug is addressed is the work that Simon Stewart did to extend the ObjectFactory to Spring. That is also part of this patch. I hope that both things can be resolved. This isn't compatible with the latest stuff from Simon Stewart, because it no longer has the Class instance... Take a look at CVS head in XWork and see what you think (and if it's still broken).
I think it would be good to check these things anyway, even if this is a Spring bug, because Spring could change the implementation returned for a name under us and we'd end up with errors again. Let me know what you find. In Spring Framework v1.0.2 each proxied bean is returned as a new class enhanced by cglib. So when using SpringObjectFactory.buildAction with spring 1.0.2 each proxied action is a different class. This causes problems when using reflection as the method returned from ActionConfig.getMethod() belongs to a different class than the object it is being invoked on. This problem has been fixed in Spring 1.1RC1. Spring 1.1RC1 now uses a factory to avoid recreating an enhancer configuration when generating a proxy for a previously proxied bean. The net affect for xwork's SpringObjectFactory is that the action returned from buildAction will now be the same as the action passed to DefaultActionInvocation.invokeAction(Action, ActionConfig). No class conflict. No reflection problems.
See Spring's jira issue: SPR-175 Has there been any progress on this? If I "auto-proxy" an
action from spring it works for a little while. Later invocations cause a stack trace like below. Its tough to predict when the are going to stop working. Many times it takes and idle period and they I try 3 minutes later. Is Xwork caching the actions? i.e. they are not being freshly retrieved from the external object factory? ---> java.lang.IllegalArgumentException: object is not an instance of declaring class sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) com.opensymphony.xwork.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:302) com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:115) com.opensymphony.webwork.dispatcher.ServletDispatcher.serviceAction(ServletDispatcher.java:278) com.opensymphony.webwork.dispatcher.ServletDispatcher.service(ServletDispatcher.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) com.opensymphony.webwork.lifecycle.RequestLifecycleFilter.doFilter(RequestLifecycleFilter.java:69) com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:142) com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:58) org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:161) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:73) Note I am using spring RC1.1. It has not fixed the product(perhaps made it take longer for the problem to occur).
Matt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
XW-168. The changes inXW-168also require some modifications to WebWork.