PDA

View Full Version : Intercept Struts actions



spalma
May 28th, 2005, 11:37 AM
hi,
I have integrated Struts with Spring by using DelegatingRequestProcessor. It works fine. Now I want to intercept Struts actions method call. I have tried this configuration:

(in struts-config.xml)
<action path="/of_add" parameter="reqCode" name="proposalForm" input="/projects/editProposal.jsp" scope="request" validate="true">
<forward name="Success" path="/projects/confirm.jsp" />
</action>
...

&#40;in spring configuration&#41;
<bean name="/of_add" class="it.palma.action.ProposalActions">
<property name="projectService">
<ref bean="projectService" />
</property>
</bean>
...

<bean id="securityAdvice" class="it.palma.aop.SecurityAdvice">
</bean>

<bean id="securityAutoProxy" class="org.springframework.aop.framework.autoproxy.BeanNa meAutoProxyCreator">
<property name="beanNames">
<list>
<value>/of_add</value>
<value>/of_search</value>
</list>
</property>
<property name="interceptorNames">
<list>
<value>securityAdvice</value>
</list>
</property>
</bean>


but I get this error:

Context initialization failed
org.springframework.beans.factory.BeanCreationExce ption&#58; Error creating bean with name '/of_add' defined in ServletContext resource &#91;/WEB-INF/job-struts-servlet.xml&#93;&#58; Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException&#58; null
java.lang.IllegalStateException&#58; Callback Lnet/sf/cglib/proxy/MethodInterceptor; is not assignable to Lnet/sf/cglib/proxy/MethodInterceptor;


Does anybody have any suggestion?
Thanks
stefano