在我们的项目中,在将SpringBoot从3.0.4
升级到3.0.9
之后,我们的几个测试开始失败。
Caused by: org.springframework.aop.framework.AopConfigException: Unexpected AOP exception
at app//org.springframework.aop.framework.CglibAopProxy.buildProxy(CglibAopProxy.java:222)
at app//org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:158)
at app//org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110)
at app//org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.buildProxy(AbstractAutoProxyCreator.java:517)
at app//org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:464)
at app//org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:369)
at app//org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:318)
at app//org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:434)
at app//org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1773)
at app//org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598)
... 80 more
Caused by: java.lang.ClassCastException: class our.project.RepositoryConfiguration$LiquibaseConfiguration$$SpringCGLIB$$0 cannot be cast to class org.springframework.cglib.proxy.Factory (our.project.RepositoryConfiguration$LiquibaseConfiguration$$SpringCGLIB$$0 and org.springframework.cglib.proxy.Factory are in unnamed module of loader 'app')
at org.springframework.aop.framework.ObjenesisCglibAopProxy.createProxyClassAndInstance(ObjenesisCglibAopProxy.java:91)
at org.springframework.aop.framework.CglibAopProxy.buildProxy(CglibAopProxy.java:213)
... 89 more
它不局限于our.project.RepositoryConfiguration$LiquibaseConfiguration
。当我禁用此配置时,下一个配置会发生类似的异常。
另一个奇怪的事情是,如果只调用单个测试类,或者首先执行这个类,则测试通过。否则会发生ClassCastException。
我们使用TestNG进行测试。
我尝试将Spring从3.0.4升级到3.0.6版本,并将Sping Boot 从3.0.4升级到3.0.6版本,我希望我们当前的所有测试都能通过。但是对于我们的~ 2000的34个测试,有一个例外java.lang.ClassCastException: class our.project.RepositoryConfiguration$LiquibaseConfiguration$$SpringCGLIB$$0 cannot be cast to class org.springframework.cglib.proxy.Factory (our.project.RepositoryConfiguration$LiquibaseConfiguration$$SpringCGLIB$$0 and org.springframework.cglib.proxy.Factory are in unnamed module of loader 'app')
1条答案
按热度按时间iq3niunx1#
最后,经过近一周的调查,我终于把那个罪人隔离了出来。Solr 8.2.1导致此问题。在Solr 8.2.0中,它与Solr 8.2.1一起工作,Spring代理有类转换异常。
很难相信这是相关的。