首页

tomcat启动dubbo应用发生IOException异常

标签:dubbo,javassist,IOException,tomcat     发布时间:2015-11-28   

一、异常日志

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener@b@java.lang.RuntimeException: java.io.IOException: invalid constant type: 18@b@ at javassist.CtClassType.getClassFile2(CtClassType.java:204)@b@ at javassist.CtClassType.subtypeOf(CtClassType.java:304)@b@ at javassist.CtClassType.subtypeOf(CtClassType.java:319)@b@ at javassist.compiler.MemberResolver.compareSignature(MemberResolver.java:248)@b@ at javassist.compiler.MemberResolver.lookupMethod(MemberResolver.java:120)@b@ at javassist.compiler.MemberResolver.lookupMethod(MemberResolver.java:97)@b@ at javassist.compiler.TypeChecker.atMethodCallCore(TypeChecker.java:711)@b@ at javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:688)@b@ at javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:157)@b@ at javassist.compiler.ast.CallExpr.accept(CallExpr.java:46)@b@ at javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:242)@b@ at javassist.compiler.CodeGen.atStmnt(CodeGen.java:330)@b@ at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)@b@ at javassist.compiler.CodeGen.atStmnt(CodeGen.java:351)@b@ at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)@b@ at javassist.compiler.CodeGen.atIfStmnt(CodeGen.java:391)@b@ at javassist.compiler.CodeGen.atStmnt(CodeGen.java:355)@b@ at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)@b@ at javassist.compiler.CodeGen.atStmnt(CodeGen.java:351)@b@ at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)@b@ at javassist.compiler.MemberCodeGen.atTryStmnt(MemberCodeGen.java:204)@b@ at javassist.compiler.CodeGen.atStmnt(CodeGen.java:367)@b@ at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)@b@ at javassist.compiler.CodeGen.atStmnt(CodeGen.java:351)@b@ at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)@b@ at javassist.compiler.CodeGen.atMethodBody(CodeGen.java:292)@b@ at javassist.compiler.CodeGen.atMethodDecl(CodeGen.java:274)@b@ at javassist.compiler.ast.MethodDecl.accept(MethodDecl.java:44)@b@ at javassist.compiler.Javac.compileMethod(Javac.java:169)@b@ at javassist.compiler.Javac.compile(Javac.java:95)@b@ at javassist.CtNewMethod.make(CtNewMethod.java:74)@b@ at javassist.CtNewMethod.make(CtNewMethod.java:45)@b@ at com.alibaba.dubbo.common.bytecode.ClassGenerator.toClass(ClassGenerator.java:318)@b@ at com.alibaba.dubbo.common.bytecode.Wrapper.makeWrapper(Wrapper.java:346)@b@ at com.alibaba.dubbo.common.bytecode.Wrapper.getWrapper(Wrapper.java:89)@b@ at com.alibaba.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:426)@b@ at com.alibaba.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:281)@b@ at com.alibaba.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:242)@b@ at com.alibaba.dubbo.config.ServiceConfig.export(ServiceConfig.java:143)@b@ at com.alibaba.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:109)@b@ at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:96)@b@ at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)@b@ at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:948)@b@ at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)@b@ at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)@b@ at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)@b@ at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)@b@ at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)@b@ at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5528)@b@ at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)@b@ at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)@b@ at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)@b@ at java.util.concurrent.FutureTask.run(FutureTask.java:266)@b@ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)@b@ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)@b@ at java.lang.Thread.run(Thread.java:745)@b@Caused by: java.io.IOException: invalid constant type: 18@b@ at javassist.bytecode.ConstPool.readOne(ConstPool.java:1113)@b@ at javassist.bytecode.ConstPool.read(ConstPool.java:1056)@b@ at javassist.bytecode.ConstPool.<init>(ConstPool.java:150)@b@ at javassist.bytecode.ClassFile.read(ClassFile.java:765)@b@ at javassist.bytecode.ClassFile.<init>(ClassFile.java:109)@b@ at javassist.CtClassType.getClassFile2(CtClassType.java:191)@b@... 55 more

二、解决步骤

1. 根据异常日志中dubbo调用javassist编译字节码出错,定位javassist版本问题;

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

3. 将dubbo引入的javassist-3.15.0-GA去掉,引入更高版本直到javassist-3.18.0-GA项目可以正常启动。

<<热门下载>>