aspose file tools*
The moose likes Struts and the fly likes Struts 2 Dynamic Method Invocation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 Dynamic Method Invocation" Watch "Struts 2 Dynamic Method Invocation" New topic
Author

Struts 2 Dynamic Method Invocation

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9384
    
    2

Guys,

I have an action definition as follows:



I also have the method implemented in the meetUpAction class which the Spring framework will inject. When I call this action I get the following error!


Is it because of the dynamic proxy thing? Does my getArchiveMeetUpList() needed to be declared in an interface so that it is visible for the dynamic proxy class? Guidance needed!


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9384
    
    2

Allright. Figured this one out. It was due to the Spring AOP proxy issue. Spring by default uses JDK dynamic proxy which means it would proxy the interface by implementing it. But for my case in my action class I need to execute a method (dynamic method invocation) by calling my action class. But at the same time I do not want to create an interface for my action class and just add this method there. So changed my applicationContxt.xml entry from:



to



and it worked. Now it makes use of CGLIB proxies.

But another question. Do I loose any performance gain here? Also CGLIB proxies do not allow my class that I'm AOP controlling to be declared as final which is already a shit for me. Any suggestions here on what could be the ideal way. I mean I prefer to use JDK dynamic proxy and at the same time I want to use Dynamic Method Invocation in Struts and at the same time I do not want to add an extra interface to avoid the proxy method not found exception.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9384
    
    2

I ended up adding an interface to my action class. Any other suggestions?
 
jQuery in Action, 2nd edition
 
subject: Struts 2 Dynamic Method Invocation