weibocom / motan

A cross-language remote procedure call(RPC) framework for rapid development of high performance distributed services.
Other
5.9k stars 1.78k forks source link

0.3版本升级到1.1之后,项目无法正常启动:Initialization of bean failed; nested exception is java.lang.AbstractMethodError #629

Open orange-online opened 6 years ago

orange-online commented 6 years ago

此次升级更换到了netty4, 并引入了如下的jar: webapp/WEB-INF/lib/codec-extension-1.1.1-SNAPSHOT.jar webapp/WEB-INF/lib/filter-opentracing-1.1.1-SNAPSHOT.jar webapp/WEB-INF/lib/metrics-core-3.0.1.jar webapp/WEB-INF/lib/motan-core-1.1.1-SNAPSHOT.jar webapp/WEB-INF/lib/motan-registry-zookeeper-1.1.1-SNAPSHOT.jar webapp/WEB-INF/lib/motan-springsupport-1.1.1-SNAPSHOT.jar webapp/WEB-INF/lib/motan-transport-netty4-1.1.1-SNAPSHOT.jar webapp/WEB-INF/lib/netty-all-4.1.16.Final.jar webapp/WEB-INF/lib/serialization-extension-1.1.1-SNAPSHOT.jar 删除了以下jar: deleted: webapp/WEB-INF/lib/motan-core-0.3.0.jar deleted: webapp/WEB-INF/lib/motan-registry-zookeeper-0.3.0.jar deleted: webapp/WEB-INF/lib/motan-springsupport-0.3.0.jar deleted: webapp/WEB-INF/lib/motan-transport-netty-0.3.0.jar deleted: webapp/WEB-INF/lib/netty-3.2.5.Final.jar

我这边还扩展了自己的Filter和Serialization。在屏蔽掉这些扩展的情况下,项目能够正常启动。但是加上这些扩展就启动异常。 以下是异常信息: Caused by: java.lang.AbstractMethodError at com.weibo.api.motan.codec.AbstractCodec.initAllSerialziation(AbstractCodec.java:80) at com.weibo.api.motan.protocol.v2motan.MotanV2Codec.(MotanV2Codec.java:57) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at com.weibo.api.motan.core.extension.ExtensionLoader.loadClass(ExtensionLoader.java:345) at com.weibo.api.motan.core.extension.ExtensionLoader.loadExtensionClasses(ExtensionLoader.java:332) at com.weibo.api.motan.core.extension.ExtensionLoader.loadExtensionClasses(ExtensionLoader.java:161) at com.weibo.api.motan.core.extension.ExtensionLoader.checkInit(ExtensionLoader.java:72) at com.weibo.api.motan.core.extension.ExtensionLoader.getExtension(ExtensionLoader.java:83) at com.weibo.api.motan.transport.AbstractServer.(AbstractServer.java:49) at com.weibo.api.motan.transport.netty4.NettyServer.(NettyServer.java:38) at com.weibo.api.motan.transport.netty4.NettyEndpointFactory.innerCreateServer(NettyEndpointFactory.java:17) at com.weibo.api.motan.transport.support.AbstractEndpointFactory.createServer(AbstractEndpointFactory.java:112) at com.weibo.api.motan.protocol.rpc.DefaultRpcExporter.(DefaultRpcExporter.java:56) at com.weibo.api.motan.protocol.rpc.DefaultRpcProtocol.createExporter(DefaultRpcProtocol.java:41) at com.weibo.api.motan.protocol.AbstractProtocol.export(AbstractProtocol.java:65) at com.weibo.api.motan.protocol.support.ProtocolFilterDecorator.export(ProtocolFilterDecorator.java:58) at com.weibo.api.motan.config.handler.SimpleConfigHandler.export(SimpleConfigHandler.java:79) at com.weibo.api.motan.config.ServiceConfig.doExport(ServiceConfig.java:211) at com.weibo.api.motan.config.ServiceConfig.export(ServiceConfig.java:129) at com.weibo.api.motan.config.springsupport.AnnotationBean.postProcessAfterInitialization(AnnotationBean.java:324)

sunnights commented 6 years ago

motan2协议的header中需要指定序列化方式,可以参见Motan2协议Header字段说明,其中serialize标记了序列化方式的序号

自定义序列化方式需要实现getSerializationNumber()接口来指定序列化方式的序号,建议使用21~31之间的序号来标记自定义的序列化方式