Articles Tutorials Interview Questions & Answers Certifications Free Books & Sample Chapters Technical Discussions    Your Account | Advertise with us | Feedback
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups  Log inLog in   RegisterRegister 

exception when trying to setup aop interceptors

 
Post new topic   Reply to topic     Forum Index -> Spring Framework
View previous topic :: View next topic  
Author Message
prad



Joined: 30 Oct 2007
Posts: 2

PostPosted: Tue Oct 30, 2007 4:53 am    Post subject: exception when trying to setup aop interceptors Reply with quote

I have been working on an application for which I have had no transactional support . I wanted to setup transactional support but when adding this to the applicationContext.xml :


Code:
<bean id="someDAO"
         class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    <property name="transactionManager"><ref bean="transactionManager"/></property>
    <property name="target"><ref bean="someDAOTarget"/></property>
    <property name="transactionAttributes">
        <props>
            <prop key="*">PROPAGATION_REQUIRED</prop>
        </props>
    </property>
   </bean>


and trying to redeploy the app , it does not deploy throwing a few exceptions . Stack :

Code:
 Factory.java:271)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:312)
        at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebAp
plicationContext.java:134)
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:230)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:156)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:48)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
        at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
        at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:625)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:431)
        at org.apache.catalina.startup.HostConfig.checkContextLastModified(HostConfig.java:849)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1085)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:327)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.core.StandardHost.backgroundProcess(StandardHost.java:800)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1619)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1628)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1608)
        at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassCastException: net.sf.cglib.proxy.Enhancer$EnhancerKey$$KeyFactoryByCGLIB$$7fb24d72
        at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
        at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117)
        at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
        at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
        at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
        ... 39 more


Can anyboody help with this..
Thanks in advance
________
DURATORQ ENGINE


Last edited by prad on Thu Feb 10, 2011 8:14 pm; edited 1 time in total
Back to top
View user's profile Send private message
sheetal



Joined: 30 Oct 2007
Posts: 1

PostPosted: Tue Oct 30, 2007 4:55 am    Post subject: Reply with quote

If the beans you are proxying do implement an interface you might specify the "proxyInterfaces" property on your TransactionProxyFactoryBean.

This way JDK dynamic proxies will be used and you have no problems with cglib.

Regards,
Sheetal
________
Bmw R32 History


Last edited by sheetal on Fri Feb 18, 2011 5:42 pm; edited 1 time in total
Back to top
View user's profile Send private message
ekta



Joined: 30 Oct 2007
Posts: 1

PostPosted: Tue Oct 30, 2007 4:56 am    Post subject: Reply with quote

I had a problem like this when I wasn't using interfaces for my AOP on my beans - my exact problem was unclear, but seemed to be some sort of odd class cast issue when the class tried to call one of it's own methods, which shouldn't have been intercepted.

E
________
Buy no2 vaporizer
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Spring Framework All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group