struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brad A Cupit" <>
Subject interesting proxy + action chain issue
Date Mon, 07 Apr 2008 16:09:36 GMT
Hi! I'm having a very interesting issue with CGLIB proxies. I'm proxying
my actions with Spring AOP (to get declarative transactions on each

Everything is working great, except when I try action chaining, I get a
class cast exception that Action2 can't be cast to Action1 (Action1 is
first in the chain).

This was very unusual, so I investigated. Here's what I found:

OgnlUtil.copy() is calling all of the getters in Action1 and pumping
that data into setters on Action2. With CGLIB, it calls getCallbacks()
and setCallbacks(), two methods created by CGLIB. This results in
Action2 having Action1's callbacks. Basically, it's similar to the
Action2 proxy referencing the Action1 target!

I can't use JDK proxies because the getters on my action (whose values
will be part of the value stack) are not defined on any interfaces, so
reflection on a JDK proxy will not find those getters.

I have a few ideas for workarounds, but I'd like to ask: has anyone else
seen this? Am I the first to try CGLIB proxies and Action chaining?

I've also read that action chaining is discouraged, but I don't
understand why. Maybe a completely different approach would work better?


Brad Cupit
Louisiana State University - UIS

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message