Announcement Announcement Module
Collapse
No announcement yet.
auto-proxying and CFLIB error on application initialization Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • auto-proxying and CFLIB error on application initialization

    I am trying to setup @AspectJ autoproxying in Spring through the
    Code:
    <aop:aspectj-autoproxy/>
    tag. However, when my application is initializing, I am getting spring configuration errors when initializing my normal POJO beans:

    Code:
    Initialization of bean failed; nested exception is: org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.
    	at org.springframework.aop.framework.DefaultAopProxyFactory.createAopProxy(DefaultAopProxyFactory.java:67)
    	at org.springframework.aop.framework.ProxyCreatorSupport.createAopProxy(ProxyCreatorSupport.java:104)
    	at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:112)
    	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:476)
    	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:362)
    	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:404)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1407)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
    	... 166 more
    If I remove
    Code:
    <aop:aspectj-autoproxy/>
    my application initializes without problems. I do not want to use CGLIB, so is there a way to avoid the CGLIB dependency? Any help would be appreciated.

    Thanks.
    Last edited by garrett0168; Dec 7th, 2009, 03:34 PM.

  • #2
    As the message indicates, you don't have CGLIB jars in your classpath. Add those and the problem should go away.

    -Ramnivas

    Comment


    • #3
      Hi Ramnivas - Thanks for your reply. I know adding the jar to my classpath will fix the problem, but I don't want the dependency on CGLIB. Is there no other way to avoid using CGLIB?

      Comment


      • #4
        You probably have a target class that doesn't implement an interface. Here Spring needs to use CGLIB to dynamically create a subclass. If you can manage to put an interface to such a class, you can avoid CGLIB dependency.

        -Ramnivas

        Comment

        Working...
        X