java.lang.IllegalStateException: Unknown callback class org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I tried to upgrade from Spring 1.0.2 to Spring 1.1 RC2 and it appears the two releases aren't 100% compatible. I changed nothing in my application context but now it won't load. It looks like the problem is with some of the AOP magic that I don't understand, but I should know enough to include the information you need to diagnose the problem. Let me know if you need more info; I will be checking email. First, the error: ERROR [main] (SpringInitializer.java:146) - Unable to load Spring application context java.lang.IllegalStateException: Unknown callback class org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor at net.sf.cglib.proxy.CallbackUtils.getGenerator(CallbackUtils.java:102) at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:298) at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:246) at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:175) at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:138) at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:66) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:260) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:182) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:285) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:204) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:135) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:223) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:284) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:114) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:96) at com.bah.krm.core.SpringInitializer.initForDb(SpringInitializer.java:140) Here is where I use AOP (taken straight from the user's manual): <bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager"> <property name="sessionFactory"><ref bean="sessionFactory"/></property> </bean> <bean id="matchAllTxInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <property name="transactionManager"><ref bean="transactionManager"/></property> <property name="transactionAttributeSource"><ref bean="matchAllWithPropReq"/></property> </bean> <bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <property name="proxyTargetClass"> <value>true</value> </property> <property name="interceptorNames"> <list> <value>matchAllTxInterceptor</value> </list> </property> <property name="beanNames"> <list> <value>test</value> </list> </property> </bean> <bean id="test" class="Test" autowire="byName"/>
    via by Matthew Sgarlata,
  • I tried to upgrade from Spring 1.0.2 to Spring 1.1 RC2 and it appears the two releases aren't 100% compatible. I changed nothing in my application context but now it won't load. It looks like the problem is with some of the AOP magic that I don't understand, but I should know enough to include the information you need to diagnose the problem. Let me know if you need more info; I will be checking email. First, the error: ERROR [main] (SpringInitializer.java:146) - Unable to load Spring application context java.lang.IllegalStateException: Unknown callback class org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor at net.sf.cglib.proxy.CallbackUtils.getGenerator(CallbackUtils.java:102) at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:298) at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:246) at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:175) at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:138) at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:66) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:260) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:182) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:285) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:204) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:135) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:223) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:284) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:114) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:96) at com.bah.krm.core.SpringInitializer.initForDb(SpringInitializer.java:140) Here is where I use AOP (taken straight from the user's manual): <bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager"> <property name="sessionFactory"><ref bean="sessionFactory"/></property> </bean> <bean id="matchAllTxInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <property name="transactionManager"><ref bean="transactionManager"/></property> <property name="transactionAttributeSource"><ref bean="matchAllWithPropReq"/></property> </bean> <bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <property name="proxyTargetClass"> <value>true</value> </property> <property name="interceptorNames"> <list> <value>matchAllTxInterceptor</value> </list> </property> <property name="beanNames"> <list> <value>test</value> </list> </property> </bean> <bean id="test" class="Test" autowire="byName"/>
    via by Matthew Sgarlata,
  • I tried to set proxyTargetClass to true for BeanNameAutoProxyCreator, but it gave me the following error. It's running fine if I turned proxyTargetClass back to false and created an interface for my pojo class. ========================= [8/30/04 11:47:10:094 EDT] 4dc3d1da ExceptionUtil X CNTR0019E: Non-application exception occurred while processing method purchase: com.ibm.ejs.container.CreateFailureException: java.lang.reflect.InvocationTargetException; nested exception is: java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.cot.esd.TestSpringSBBean' defined in URL [file:/C:/projects/TestJ2EE/TestJ2EEEjb/bin/beanRefContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanException: Could not instantiate class [org.springframework.context.support.ClassPathXmlApplicationContext]; constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'purchaseManager' defined in class path resource [com/cot/esd/springContext.xml]: Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException: null org.springframework.beans.FatalBeanException: Could not instantiate class [org.springframework.context.support.ClassPathXmlApplicationContext]; constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'purchaseManager' defined in class path resource [com/cot/esd/springContext.xml]: Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException: null org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'purchaseManager' defined in class path resource [com/cot/esd/springContext.xml]: Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException: null java.lang.IllegalStateException: Callback Lnet/sf/cglib/proxy/MethodInterceptor; is not assignable to Lnet/sf/cglib/proxy/MethodInterceptor; at net.sf.cglib.proxy.Enhancer.validate(Enhancer.java:374) at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:399) at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:318) at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:175) at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:138) at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:66) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:260) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:182) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:285) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:204) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:135) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:223) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:284) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:80) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65) at java.lang.reflect.Constructor.newInstance(Native Method) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:71) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:66) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:470) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:247) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:204) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:135) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:223) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:284) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:83) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:68) at org.springframework.context.access.ContextSingletonBeanFactoryLocator.createDefinition(ContextSingletonBeanFactoryLocator.java:112) at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:385) at org.springframework.ejb.support.AbstractEnterpriseBean.loadBeanFactory(AbstractEnterpriseBean.java:115) at org.springframework.ejb.support.AbstractStatelessSessionBean.ejbCreate(AbstractStatelessSessionBean.java:63) at java.lang.reflect.Method.invoke(Native Method) at com.ibm.ejs.container.StatelessBeanO.<init>(StatelessBeanO.java:114) at com.ibm.ejs.container.BMStatelessBeanO.<init>(BMStatelessBeanO.java:32) at com.ibm.ejs.container.BMStatelessBeanOFactory.create(BMStatelessBeanOFactory.java:17) at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:464) at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:548) at com.ibm.ejs.container.activator.UncachedActivationStrategy.atActivate(UncachedActivationStrategy.java:66) at com.ibm.ejs.container.activator.Activator.activateBean(Activator.java:186) at com.ibm.ejs.container.EJSContainer.preInvoke(EJSContainer.java:1646)
    via by Victor,
  • I tried to set proxyTargetClass to true for BeanNameAutoProxyCreator, but it gave me the following error. It's running fine if I turned proxyTargetClass back to false and created an interface for my pojo class. ========================= [8/30/04 11:47:10:094 EDT] 4dc3d1da ExceptionUtil X CNTR0019E: Non-application exception occurred while processing method purchase: com.ibm.ejs.container.CreateFailureException: java.lang.reflect.InvocationTargetException; nested exception is: java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.cot.esd.TestSpringSBBean' defined in URL [file:/C:/projects/TestJ2EE/TestJ2EEEjb/bin/beanRefContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanException: Could not instantiate class [org.springframework.context.support.ClassPathXmlApplicationContext]; constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'purchaseManager' defined in class path resource [com/cot/esd/springContext.xml]: Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException: null org.springframework.beans.FatalBeanException: Could not instantiate class [org.springframework.context.support.ClassPathXmlApplicationContext]; constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'purchaseManager' defined in class path resource [com/cot/esd/springContext.xml]: Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException: null org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'purchaseManager' defined in class path resource [com/cot/esd/springContext.xml]: Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException: null java.lang.IllegalStateException: Callback Lnet/sf/cglib/proxy/MethodInterceptor; is not assignable to Lnet/sf/cglib/proxy/MethodInterceptor; at net.sf.cglib.proxy.Enhancer.validate(Enhancer.java:374) at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:399) at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:318) at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:175) at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:138) at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:66) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:260) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:182) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:285) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:204) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:135) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:223) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:284) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:80) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65) at java.lang.reflect.Constructor.newInstance(Native Method) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:71) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:66) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:470) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:247) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:204) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:135) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:223) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:284) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:83) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:68) at org.springframework.context.access.ContextSingletonBeanFactoryLocator.createDefinition(ContextSingletonBeanFactoryLocator.java:112) at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:385) at org.springframework.ejb.support.AbstractEnterpriseBean.loadBeanFactory(AbstractEnterpriseBean.java:115) at org.springframework.ejb.support.AbstractStatelessSessionBean.ejbCreate(AbstractStatelessSessionBean.java:63) at java.lang.reflect.Method.invoke(Native Method) at com.ibm.ejs.container.StatelessBeanO.<init>(StatelessBeanO.java:114) at com.ibm.ejs.container.BMStatelessBeanO.<init>(BMStatelessBeanO.java:32) at com.ibm.ejs.container.BMStatelessBeanOFactory.create(BMStatelessBeanOFactory.java:17) at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:464) at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:548) at com.ibm.ejs.container.activator.UncachedActivationStrategy.atActivate(UncachedActivationStrategy.java:66) at com.ibm.ejs.container.activator.Activator.activateBean(Activator.java:186) at com.ibm.ejs.container.EJSContainer.preInvoke(EJSContainer.java:1646)
    via by Victor,
    • java.lang.IllegalStateException: Unknown callback class org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor at net.sf.cglib.proxy.CallbackUtils.getGenerator(CallbackUtils.java:102) at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:298) at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:246) at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:175) at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:138) at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:66) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:260) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:182) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:285) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:204) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:135) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:223) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:284) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:114) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:96) at com.bah.krm.core.SpringInitializer.initForDb(SpringInitializer.java:140)
    No Bugmate found.