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

 

posted @ 2018-02-16 14:55  xiluhua  阅读(1114)  评论(0编辑  收藏  举报