|
[
Permlink
| « Hide
]
Rob Harrop added a comment - 08/Aug/05 01:02 PM
I added CglibProxyTests.testSPR1211() to try a reproduce this and I was unable to do so. Can you check to see if this test matches your scenario?
Somehow, the proxy works fine if the target class is not Spring MVC controller.
In this case, it's a stub controller(not implementing Spring's Controller interface). You can see from the stack trace that "this" object is still the target class, the proxy class is TestController$$FastClassByCGLIB$...; but if target class is Spring MVC controller, "this" object becomes RealController$$EnhancerByCGLIB$$...(not shown in this screen shot) The screenshot you have shows the TestController object as being this. Can you check which version of CGLIB you are using? Older versions of CGLIB didn't support a feature that we can now use to prevent target object state from being reset in certain cases. You should use the version in the latest (1.2.3) Spring distribution.
If this doesn't work can you post your code for your TestController - I'll see if I can make this fail on may machine. Can you create a test case that loads you actual application context and shows the NPE and post it here. I'm pretty much running blind at the moment until I can see this error actually manifested.
Rob Jieba,
I managed to get the test to fail finally. I know what the cause of this is now, but I'm not sure if there is an elegant way in which we can solve it. In the meantime, I would recommend that you use JDK proxies to get around this issue. Rob Jieba,
The final status of this issue is that you can't CGLIB to proxy the class you are trying to proxy. The reason for this is that the handleRequest() method is final and thus cannot be overridden by the proxy subclass. I will be modifying the CGLIB proxy mechanism so that WARN messages are written in the log when there are methods on the class that are final. Rob |
||||||||||||||||||||||||||||||||||||||||||||||||||||||