Announcement Announcement Module
Collapse
No announcement yet.
Exception when applying interceptor to DelegatingActionProxy Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exception when applying interceptor to DelegatingActionProxy

    hello all,
    i am integrating Struts with Spring via DelegatingActionProxy bean defined in applicationContext.xml

    I wanted to apply a tracing advisor to a specific DelegatingActionProxy, so i defind a BeanNameAutoProxyCreator with beanName of /logon (one of my delegatingActionProxy)
    and i applied a TracingAdvisor to it

    Below is excerpt of my applicationContext.xml


    <bean id="jdkBeanNameProxyCreator"
    class="org.springframework.aop.framework.autoproxy .BeanNameAutoProxyCreator">
    <property name="beanNames">
    <value>/logon</value>
    </property>
    <property name="interceptorNames">
    <value>tracingAdvisor</value>
    </property>
    </bean>

    <bean id="tracingInterceptor" class="com.myapp.aop.TracingInterceptor"/>

    <bean id="tracingAdvisor"
    class="org.springframework.aop.support.RegexpMetho dPointcutAdvisor">
    <property name="advice">
    <ref local="tracingInterceptor"/>
    </property>
    <property name="pattern">
    <value>.*</value>
    </property>
    </bean>

    <bean name="/logon" class="com.myapp.action.LoginAction"
    singleton="false">
    <property name="persistenceManager">
    <ref bean="persistenceManager"/>
    </property>
    </bean>

    when the interceptor is applied, i got following exception

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean wit
    h name '/logon' defined in resource [/WEB-INF/applicationContext.xml] of Servlet
    Context: Initialization of bean failed; nested exception is org.aopalliance.aop.
    AspectException: null
    java.lang.IllegalStateException: Unknown callback class org.springframework.aop.
    framework.Cglib2AopProxy$DynamicAdvisedInterceptor
    at net.sf.cglib.proxy.CallbackUtils.getGenerator(Call backUtils.java:99)
    at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer. java:298)
    at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:2 46)
    at org.springframework.aop.framework.Cglib2AopProxy.g etProxy(Cglib2AopPr
    oxy.java:171)
    at org.springframework.aop.framework.Cglib2AopProxy.g etProxy(Cglib2AopPr
    oxy.java:136)
    at org.springframework.aop.framework.ProxyFactory.get Proxy(ProxyFactory.
    java:66)
    at org.springframework.aop.framework.autoproxy.Abstra ctAutoProxyCreator.
    postProcessAfterInitialization(AbstractAutoProxyCr eator.java:260)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.applyBeanPostProcessorsAfterInitialization (AbstractAutowireCapableBeanFa
    ctory.java:187)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.createBean(AbstractAutowireCapableBeanFact ory.java:289)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.createBean(AbstractAutowireCapableBeanFact ory.java:208)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean
    (AbstractBeanFactory.java:217)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean
    (AbstractBeanFactory.java:136)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean
    (AbstractBeanFactory.java:223)
    at org.springframework.context.support.AbstractApplic ationContext.getBea
    n(AbstractApplicationContext.java:435)
    at org.springframework.web.struts.DelegatingActionPro xy.getDelegateActio
    n(DelegatingActionProxy.java:120)
    at org.springframework.web.struts.DelegatingActionPro xy.execute(Delegati
    ngActionProxy.java:103)
    at org.apache.struts.action.RequestProcessor.processA ctionPerform(Reques
    tProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process( RequestProcessor.ja
    va:274)
    at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:148
    2)
    at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:525)

    at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)



    My guess is that the exception is happening because i already have a Proxy (delegatingActionProxy) and i am trying to get a proxy of a proxy..

    But if that is the case, how can i declare advisors on DelegatingActionProxy classes?

    thanx and regards
    marco

  • #2
    Has anyone found the answer to this

    I've seen this question posted, but where is the solution?

    Comment

    Working...
    X