Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring Transaction - Proxy confusion
    primarykey
    data
    text
    <pre><code> &lt;tx:advice id="txAdvice" transaction-manager="jtaTxManager"&gt; &lt;tx:attributes&gt; &lt;tx:method name="*" /&gt; &lt;/tx:attributes&gt; &lt;/tx:advice&gt; &lt;aop:config proxy-target-class="true"&gt; &lt;aop:pointcut id="fooServiceOperation" expression="execution(* x.y.SampClass.save(..))" /&gt; &lt;aop:advisor advice-ref="txAdvice" pointcut-ref="fooServiceOperation" /&gt; &lt;/aop:config&gt; &lt;bean id="Samp1" class=" x.y.SampClass"&gt;&lt;/bean&gt; &lt;bean id="SearchDispatchRpcGwtServlet" class="x.y.server.SearchDispatchRpcGwtServlet"&gt; &lt;constructor-arg&gt; &lt;list&gt; &lt;ref bean="webServiceClient"/&gt; &lt;/list&gt; &lt;/constructor-arg&gt; &lt;/bean&gt; &lt;!-- Service Clients --&gt; &lt;bean id="webServiceClient" class="x.y.KSBClientProxyFactoryBean"&gt; &lt;property name="serviceEndpointInterface" value="x.y.service.WebService" /&gt; &lt;property name="serviceQName" value="{http://x.y.org/wsdl/organization}WebService" /&gt; &lt;/bean&gt; </code></pre> <p>This is the part of sample spring context file. I am trying to create a transaction advice for <code>SampClass</code> to execute on the save method.</p> <p>So from my understanding it should create a proxy for <code>SampClass</code> only.</p> <p>I have a <code>SearchDispatchRpcGwtServlet</code> which takes as an argument a webservice Client which is also a proxy in itself. This bean is also getting proxied for some reason where it fails because it cannot create a proxy of a proxy.</p> <p>I must add that <code>SearchDispatchRpcGwtServlet</code> creates an instance of <code>SampClass</code> and calls the save method.</p> <p>I get the following exception:</p> <blockquote> <p>java.lang.IllegalArgumentException: Cannot subclass final class class $Proxy118 at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer .java:446) at net.sf.cglib.transform.TransformingClassGenerator. generateClass(TransformingClassGenerator.java:33)</p> </blockquote> <p>I dont understand why <code>SearchDispatchRpcGwtServlet</code> proxy is getting created. Can someone explain. </p> <p>Addition Stack Trace</p> <pre><code>Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class $Proxy117]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class $Proxy117 at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:213) at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:473) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:348) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:309) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:361) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.postProcessObjectFromFactoryBean(AbstractAutowireCapableBeanFactory.java:1427) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport$1.run(FactoryBeanRegistrySupport.java:139) ... 85 more Caused by: java.lang.IllegalArgumentException: Cannot subclass final class class $Proxy117 at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:446) at net.sf.cglib.transform.TransformingClassGenerator.generateClass(TransformingClassGenerator.java:33) at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216) at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377) at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285) at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:201) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload