dubbo:service 异常:in com.alibaba.dubbo.common.bytecode.Wrapper93: inconsistent stack height -1

it2022-05-05  96

Exception in thread "main" java.lang.RuntimeException: [source error] getPropertyValue (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; in com.alibaba.dubbo.common.bytecode.Wrapper93: inconsistent stack height -1     at com.alibaba.dubbo.common.bytecode.ClassGenerator.toClass(ClassGenerator.java:350)     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.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)     at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)     at com.qicai.DubboStartup.main(DubboStartup.java:13) Caused by: javassist.CannotCompileException: [source error] getPropertyValue (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; in com.alibaba.dubbo.common.bytecode.Wrapper93: inconsistent stack height -1     at javassist.CtNewMethod.make(CtNewMethod.java:79)     at javassist.CtNewMethod.make(CtNewMethod.java:45)     at com.alibaba.dubbo.common.bytecode.ClassGenerator.toClass(ClassGenerator.java:318)     ... 19 more Caused by: compile error: getPropertyValue (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; in com.alibaba.dubbo.common.bytecode.Wrapper93: inconsistent stack height -1     at javassist.compiler.Javac.compile(Javac.java:104)     at javassist.CtNewMethod.make(CtNewMethod.java:74)     ... 21 more

 

 

解决方式:

根据大佬的提示:https://blog.csdn.net/henlf/article/details/81674517

由于在添加接口之前,一切都是正常的,因此可以排除 dubbo 版本问题,在网上查找资料说可能是由于提供的接口以 getXXX 开头,而且接口没有返回值,从而出现此种异常。因此试着先把问题给解决了,就按文章说的,把接口名称给改了,不以 get 开头,经验证,确实是此原因。那么为什么会有这么奇怪的现象出现呢?查看了下 dubbo 源码,dubbo 动态生成代码

讲service里的接口 改成非get开头,启动正常。


最新回复(0)