Spring cglib 初始化 ExceptionInInitializerError,new Enhancer() 异常

Posted xiluhua

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Spring cglib 初始化 ExceptionInInitializerError,new Enhancer() 异常相关的知识,希望对你有一定的参考价值。

解决办法:更换 spring-cglib-repack-*.*.jar 包

java.lang.ExceptionInInitializerError
    at org.springframework.aop.framework.CglibAopProxy.createEnhancer(CglibAopProxy.java:235)
    at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:177)
    at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:112)
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:497)
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:382)
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:338)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:423)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1696)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:245)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:743)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:767)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:489)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    at inspect.into.spring.ann.b37.Lesson_b37.main(Lesson_b37.java:19)
Caused by: java.lang.IllegalArgumentException
    at org.springframework.asm.MethodVisitor.<init>(MethodVisitor.java:86)
    at org.springframework.cglib.core.LocalVariablesSorter.<init>(LocalVariablesSorter.java:66)
    at org.springframework.cglib.core.CodeEmitter.<init>(CodeEmitter.java:106)
    at org.springframework.cglib.core.ClassEmitter.begin_method(ClassEmitter.java:176)
    at org.springframework.cglib.core.EmitUtils.null_constructor(EmitUtils.java:87)
    at org.springframework.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:183)
    at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
    at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:231)
    at org.springframework.cglib.core.KeyFactory$Generator.create(KeyFactory.java:149)
    at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:117)
    at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:109)
    at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:105)
    at org.springframework.cglib.proxy.Enhancer.<clinit>(Enhancer.java:71)
    ... 20 more

 

以上是关于Spring cglib 初始化 ExceptionInInitializerError,new Enhancer() 异常的主要内容,如果未能解决你的问题,请参考以下文章

java.lang.NoClassDefFoundError:部署到Google App Engine时无法初始化类net.sf.cglib.proxy.Enhancer。

Spring中的cglib动态代理

Spring中cglib动态代理

Spring的事务与AOP实现原理

Spring AOP:CGLIB动态代理

CGLIB动态代理探索(ASM,Spring)#yyds干货盘点#