<tx:advice id="txAdvice" transaction-manager="jtaTxManager">
<tx:attributes>
<tx:method name="*" />
</tx:attributes>
</tx:advice>
<aop:config proxy-target-class="true">
<aop:pointcut id="fooServiceOperation"
expression="execution(* x.y.SampClass.save(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="fooServiceOperation" />
</aop:config>
<bean id="Samp1" class=" x.y.SampClass"></bean>
<bean id="SearchDispatchRpcGwtServlet" class="x.y.server.SearchDispatchRpcGwtServlet">
<constructor-arg>
<list>
<ref bean="webServiceClient"/>
</list>
</constructor-arg>
</bean>
<!-- Service Clients -->
<bean id="webServiceClient" class="x.y.KSBClientProxyFactoryBean">
<property name="serviceEndpointInterface" value="x.y.service.WebService" />
<property name="serviceQName" value="{http://x.y.org/wsdl/organization}WebService" />
</bean>
This is the part of sample spring context file. I am trying to create a transaction advice for SampClass
to execute on the save method.
So from my understanding it should create a proxy for SampClass
only.
I have a SearchDispatchRpcGwtServlet
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.
I must add that SearchDispatchRpcGwtServlet
creates an instance of SampClass
and calls the save method.
I get the following exception:
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)
I dont understand why SearchDispatchRpcGwtServlet
proxy is getting created. Can someone explain.
Addition Stack Trace
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)