org.javassist包版本不兼容jdk1.8的问题

 1 Exception in thread "pool-1-thread-1" java.lang.RuntimeException: java.io.IOException: invalid constant type: 18
 2         at javassist.CtClassType.getClassFile2(CtClassType.java:204)
 3         at javassist.CtClassType.subtypeOf(CtClassType.java:304)
 4         at javassist.CtClassType.subtypeOf(CtClassType.java:319)
 5         at javassist.compiler.MemberResolver.compareSignature(MemberResolver.java:248)
 6         at javassist.compiler.MemberResolver.lookupMethod(MemberResolver.java:120)
 7         at javassist.compiler.MemberResolver.lookupMethod(MemberResolver.java:97)
 8         at javassist.compiler.TypeChecker.atMethodCallCore(TypeChecker.java:711)
 9         at javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:688)
10         at javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:157)
11         at javassist.compiler.ast.CallExpr.accept(CallExpr.java:46)
12         at javassist.compiler.JvstTypeChecker.atCastToWrapper(JvstTypeChecker.java:126)
13         at javassist.compiler.JvstTypeChecker.atCastExpr(JvstTypeChecker.java:98)
14         at javassist.compiler.ast.CastExpr.accept(CastExpr.java:55)
15         at javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:242)
16         at javassist.compiler.CodeGen.compileExpr(CodeGen.java:229)
17         at javassist.compiler.CodeGen.atReturnStmnt2(CodeGen.java:598)
18         at javassist.compiler.JvstCodeGen.atReturnStmnt(JvstCodeGen.java:425)
19         at javassist.compiler.CodeGen.atStmnt(CodeGen.java:363)
20         at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
21         at javassist.compiler.CodeGen.atStmnt(CodeGen.java:351)
22         at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
23         at javassist.compiler.CodeGen.atIfStmnt(CodeGen.java:391)
24         at javassist.compiler.CodeGen.atStmnt(CodeGen.java:355)
25         at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
26         at javassist.compiler.CodeGen.atStmnt(CodeGen.java:351)
27         at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
28         at javassist.compiler.MemberCodeGen.atTryStmnt(MemberCodeGen.java:204)
29         at javassist.compiler.CodeGen.atStmnt(CodeGen.java:367)
30         at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
31         at javassist.compiler.CodeGen.atStmnt(CodeGen.java:351)
32         at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
33         at javassist.compiler.CodeGen.atMethodBody(CodeGen.java:292)
34         at javassist.compiler.CodeGen.atMethodDecl(CodeGen.java:274)
35         at javassist.compiler.ast.MethodDecl.accept(MethodDecl.java:44)
36         at javassist.compiler.Javac.compileMethod(Javac.java:169)
37         at javassist.compiler.Javac.compile(Javac.java:95)
38         at javassist.CtNewMethod.make(CtNewMethod.java:74)
39         at javassist.CtNewMethod.make(CtNewMethod.java:45)
40         at com.alibaba.dubbo.common.bytecode.ClassGenerator.toClass(ClassGenerator.java:318)
41         at com.alibaba.dubbo.common.bytecode.Wrapper.makeWrapper(Wrapper.java:346)
42         at com.alibaba.dubbo.common.bytecode.Wrapper.getWrapper(Wrapper.java:89)
43         at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory.getInvoker(JavassistProxyFactory.java:40)
44         at com.alibaba.dubbo.rpc.proxy.wrapper.StubProxyFactoryWrapper.getInvoker(StubProxyFactoryWrapper.java:104)
45         at com.alibaba.dubbo.rpc.ProxyFactory$Adpative.getInvoker(ProxyFactory$Adpative.java)
46         at com.alibaba.dubbo.config.ServiceConfig.exportLocal(ServiceConfig.java:507)
47         at com.alibaba.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:465)
48         at com.alibaba.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:281)
49         at com.alibaba.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:242)
50         at com.alibaba.dubbo.config.ServiceConfig.export(ServiceConfig.java:143)
51         at com.alibaba.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:109)
52         at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
53         at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
54         at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:383)
55         at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:337)
56         at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:882)
57         at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545)
58         at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
59         at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
60         at banniu.app.logistics.AppLogisticsMain$1.run(AppLogisticsMain.java:30)
61         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
62         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
63         at java.lang.Thread.run(Thread.java:745)
64 Caused by: java.io.IOException: invalid constant type: 18
65         at javassist.bytecode.ConstPool.readOne(ConstPool.java:1113)
66         at javassist.bytecode.ConstPool.read(ConstPool.java:1056)
67         at javassist.bytecode.ConstPool.<init>(ConstPool.java:150)
68         at javassist.bytecode.ClassFile.read(ClassFile.java:765)
69         at javassist.bytecode.ClassFile.<init>(ClassFile.java:109)
70         at javassist.CtClassType.getClassFile2(CtClassType.java:191)
71         ... 61 more

报错信息如上图所示 , 这个是由于dubbo2.5.3使用的org.javassist的包版本是3.15.0-GA , 但是我服务器上面的jdk版本是1.8的 , 结果导致不兼容 ,

原因:javassist 3.18以下的版本不支持在JDK1.8下运行详情点击.

 

解决方法有两个:

1 使用JDK1.7或者以下版本.

2 升级javassist 到3.18或以上版本.

我的建议是使用第二种方法 , 毕竟大家现在都趋向于升级jdk到1.8以上

 

附上我的解决方式

 

原文地址:https://www.cnblogs.com/pengyonglei/p/6741984.html