JDK1.8 报错java.io.IOException: invalid constant type: 18

Caused by: java.lang.RuntimeException: java.io.IOException: invalid constant type: 18
	at javassist.CtClassType.getClassFile2(CtClassType.java:204)
	at javassist.compiler.MemberResolver.lookupMethod(MemberResolver.java:111)
	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:318)
	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.rpc.proxy.javassist.JavassistProxyFactory.getInvoker(JavassistProxyFactory.java:40)
	at com.alibaba.dubbo.rpc.proxy.wrapper.StubProxyFactoryWrapper.getInvoker(StubProxyFactoryWrapper.java:104)
	at com.alibaba.dubbo.rpc.ProxyFactory$Adpative.getInvoker(ProxyFactory$Adpative.java)
	at com.alibaba.dubbo.config.ServiceConfig.exportLocal(ServiceConfig.java:507)
	at com.alibaba.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:465)
	at com.alibaba.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:281)
	at com.alibaba.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:242)
	at com.alibaba.dubbo.config.ServiceConfig.export(ServiceConfig.java:143)
	at com.alibaba.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:109)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:773)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:125)
	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)
	at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:108)
	at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:260)
	at org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:63)
	at org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:83)
	... 24 more
Caused by: java.io.IOException: invalid constant type: 18
	at javassist.bytecode.ConstPool.readOne(ConstPool.java:1113)
	at javassist.bytecode.ConstPool.read(ConstPool.java:1056)
	at javassist.bytecode.ConstPool.<init>(ConstPool.java:150)
	at javassist.bytecode.ClassFile.read(ClassFile.java:765)
	at javassist.bytecode.ClassFile.<init>(ClassFile.java:109)
	at javassist.CtClassType.getClassFile2(CtClassType.java:191)
	... 81 more

根据报错:最后一个Caused by: java.io.IOException: invalid constant type: 18
    at javassist.bytecode.ConstPool.readOne(ConstPool.java:1113) //这里出现异常,

在根据第一个Caused by中:

    at javassist.CtNewMethod.make(CtNewMethod.java:45)
    at com.alibaba.dubbo.common.bytecode.ClassGenerator.toClass(ClassGenerator.java:318) //这里看到是dubbo依赖的

在JDK1.8项目中引用了 javassist-3.15.0-GA.jar  出现了错误,升级3.24.1-GA完美解决,项目中引用dubbo版本为2.5.3版本,依赖javassist 3.15.0-GA版本 。

由于同样的dubbo项目在jdk6下没有问题,当前项目使用的jdk8,所以应该是jdk8和javassist冲突;

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值