Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'XXX'
Caused by: java.lang.RuntimeException: java.io.IOException: invalid constant type: 15
at javassist.CtClassType.getClassFile2(CtClassType.java:204)
at javassist.CtClassType.subtypeOf(CtClassType.java:304)
at javassist.CtClassType.subtypeOf(CtClassType.java:319)
at javassist.compiler.MemberResolver.compareSignature(MemberResolver.java:248)
at javassist.compiler.MemberResolver.lookupMethod(MemberResolver.java:120)
at javassist.compiler.MemberResolver.lookupMethod(MemberResolver.java:97)
at javassist.compiler.TypeChecker.atMethodCallCore(TypeChecker.java:711)
at javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:688)
at javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:157)
at javassist.compiler.ast.CallExpr.accept(CallExpr.java:46)
at javassist.compiler.JvstTypeChecker.atCastToWrapper(JvstTypeChecker.java:126)
at javassist.compiler.JvstTypeChecker.atCastExpr(JvstTypeChecker.java:98)
at javassist.compiler.ast.CastExpr.accept(CastExpr.java:55)
at javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:242)
at javassist.compiler.CodeGen.compileExpr(CodeGen.java:229)
at javassist.compiler.CodeGen.atReturnStmnt2(CodeGen.java:598)
at javassist.compiler.JvstCodeGen.atReturnStmnt(JvstCodeGen.java:425)
at javassist.compiler.CodeGen.atStmnt(CodeGen.java:363)
at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
at javassist.compiler.CodeGen.atStmnt(CodeGen.java:351)
at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
at javassist.compiler.CodeGen.atIfStmnt(CodeGen.java:391)
at javassist.compiler.CodeGen.atStmnt(CodeGen.java:355)
at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
at javassist.compiler.CodeGen.atStmnt(CodeGen.java:351)
at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
at javassist.compiler.MemberCodeGen.atTryStmnt(MemberCodeGen.java:204)
at javassist.compiler.CodeGen.atStmnt(CodeGen.java:367)
at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
at javassist.compiler.CodeGen.atStmnt(CodeGen.java:351)
at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
at javassist.compiler.CodeGen.atMethodBody(CodeGen.java:292)
at javassist.compiler.CodeGen.atMethodDecl(CodeGen.java:274)
at javassist.compiler.ast.MethodDecl.accept(MethodDecl.java:44)
at javassist.compiler.Javac.compileMethod(Javac.java:169)
at javassist.compiler.Javac.compile(Javac.java:95)
at javassist.CtNewMethod.make(CtNewMethod.java:74)
at javassist.CtNewMethod.make(CtNewMethod.java:45)
at com.alibaba.dubbo.common.bytecode.ClassGenerator.toClass(ClassGenerator.java:322)
at com.alibaba.dubbo.common.bytecode.ClassGenerator.toClass(ClassGenerator.java:293)
at com.alibaba.dubbo.common.bytecode.Wrapper.makeWrapper(Wrapper.java:346)
at com.alibaba.dubbo.common.bytecode.Wrapper.getWrapper(Wrapper.java:89)
at com.alibaba.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:430)
at com.alibaba.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:285)
at com.alibaba.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:246)
at com.alibaba.dubbo.config.ServiceConfig.export(ServiceConfig.java:145)
at com.alibaba.dubbo.config.spring.AnnotationBean.postProcessAfterInitialization(AnnotationBean.java:202)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:422)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1571)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
... 11 more
Caused by: java.io.IOException: invalid constant type: 15
at javassist.bytecode.ConstPool.readOne(ConstPool.java:1113)
at javassist.bytecode.ConstPool.read(ConstPool.java:1056)
at javassist.bytecode.ConstPool.
(ConstPool.java:150)
at javassist.bytecode.ClassFile.read(ClassFile.java:765)
at javassist.bytecode.ClassFile.(ClassFile.java:109)
at javassist.CtClassType.getClassFile2(CtClassType.java:191)
... 60 more
最后发现是javassist 包版本过低导致,升级为3.20.0-GA问题解决。
原因在于:Java 8u11中的JVM字节码验证子系统发生变化而导致的。Java语言要求任何调用超类构造函数必须在第一次调用时进行,但Java早期版本中的字节码验证器并没有强制去验证,甲骨文公司开始考虑解决这一问题,但目前来看似乎影响了一些第三方工具。其中受影响的工具包括JavaEE开发工具JRebel、Java字节码操作库Javassist、依赖注入框架Google Guice、代码覆盖工具Jacoco等,此外,Groovy编程语言也被报告不兼容。