spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.48k stars 38.1k forks source link

java.lang.IllegalStateException: Unknown callback class org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor [SPR-296] #5026

Closed spring-projects-issues closed 20 years ago

spring-projects-issues commented 20 years ago

Matthew Sgarlata opened SPR-296 and commented

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.\(FileSystemXmlApplicationContext.java:114) at org.springframework.context.support.FileSystemXmlApplicationContext.\(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"> \\\ \

\<bean id="matchAllTxInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"> \\\ \\\ \

\<bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> \ \true\ \ \ \ \matchAllTxInterceptor\ \ \ \ \ \test\ \ \ \

\<bean id="test" class="Test" autowire="byName"/>


Affects: 1.1 RC2

spring-projects-issues commented 20 years ago

Juergen Hoeller commented

This is most likely an issue with the CGLIB version: CGLIB internally doesn't recognize the MethodInterceptor interface that the new version of Spring's Cglib2AopProxy uses.

Have you updated your project libraries to CGLIB 2.0.2, which comes with the Spring 1.1 RC2 distribution? Spring 1.1 RC2 requires CGLIB 2.0.2, as it leverages some new features introduced there.

Please also make sure that no old CGLIB jar is lying around in the classpath.

Juergen

spring-projects-issues commented 20 years ago

Matthew Sgarlata commented

Oops, my bad. I needed the correct Cglib JAR.

Unfortunately though, it looks like RC2 doesn't have the JDBC fix I was looking for. I will enter a separate report for that.

spring-projects-issues commented 20 years ago

Juergen Hoeller commented

Never mind, at least CGLIB works again :-)