baomidou / mybatis-plus

An powerful enhanced toolkit of MyBatis for simplify development
https://baomidou.com
Apache License 2.0
16.42k stars 4.31k forks source link

3.1.1mp导致dubbo使用序列化错误 #1065

Closed funky-eyes closed 5 years ago

funky-eyes commented 5 years ago

当前使用版本(必须填写清楚,否则不予处理)

3.1.1

该问题是怎么引起的?*([最新版](https://search.maven.org/search?q=g:com.baomidou%20a:mybatis-)上已修复的会直接close掉)**

3.1.0时没有任何异常,3.1.1后,远程调用,如果是构建QueryWrapper,然后把QueryWrapper传输到服务端,直接会出现序列化异常

重现步骤

selectUser.getOne(new QueryWrapper().eq("mobileNum", user.getPhone()));

报错信息

消费者:

2019-04-26 15:22:09.572 ERROR 28384 --- [0.0-8081-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method getOne in the service com.example.service.IFrontUserSelectService. Tried 3 times of the providers [192.168.14.51:20880] (1/1) from the registry 127.0.0.1:2181 on the consumer 192.168.14.51 using the dubbo version 2.0.1. Last error is: Failed to invoke remote method: getOne, provider: dubbo://192.168.14.51:20880/com.example.service.IFrontUserSelectService?anyhost=true&application=dubbo-demo-client&check=false&dubbo=2.0.1&generic=false&interface=com.example.service.IFrontUserSelectService&methods=removeById,lambdaQuery,save,removeByMap,update,getObj,saveOrUpdateBatch,remove,listByIds,getBaseMapper,removeByIds,updateBatchById,lambdaUpdate,saveOrUpdate,listMaps,saveBatch,query,count,listObjs,list,getMap,updateById,pageMaps,listByMap,getById,getOne,page&pid=28384&register.ip=192.168.14.51&remote.timestamp=1556263101557&revision=1.0.0&serialization=java&side=consumer&timestamp=1556263321965&version=1.0.0, cause: Fail to decode request due to: RpcInvocation [methodName=getOne, parameterTypes=[class com.baomidou.mybatisplus.core.conditions.Wrapper], arguments=null, attachments={path=com.example.service.IFrontUserSelectService, input=3232, dubbo=2.0.1, version=1.0.0}]] with root cause

com.alibaba.dubbo.remoting.RemotingException: Fail to decode request due to: RpcInvocation [methodName=getOne, parameterTypes=[class com.baomidou.mybatisplus.core.conditions.Wrapper], arguments=null, attachments={path=com.example.service.IFrontUserSelectService, input=3232, dubbo=2.0.1, version=1.0.0}]
    at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.returnFromResponse(DefaultFuture.java:218) ~[dubbo-2.5.10.jar:2.0.1]
    at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.get(DefaultFuture.java:137) ~[dubbo-2.5.10.jar:2.0.1]
    at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.get(DefaultFuture.java:111) ~[dubbo-2.5.10.jar:2.0.1]
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboInvoker.doInvoke(DubboInvoker.java:95) ~[dubbo-2.5.10.jar:2.0.1]
    at com.alibaba.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:142) ~[dubbo-2.5.10.jar:2.0.1]
    at com.alibaba.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:73) ~[dubbo-2.5.10.jar:2.0.1]
    at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:74) ~[dubbo-2.5.10.jar:2.0.1]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68) ~[dubbo-2.5.10.jar:2.0.1]
    at com.alibaba.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:53) ~[dubbo-2.5.10.jar:2.0.1]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68) ~[dubbo-2.5.10.jar:2.0.1]
    at com.alibaba.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:47) ~[dubbo-2.5.10.jar:2.0.1]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68) ~[dubbo-2.5.10.jar:2.0.1]
    at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:52) ~[dubbo-2.5.10.jar:2.0.1]
    at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:77) ~[dubbo-2.5.10.jar:2.0.1]
    at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:232) ~[dubbo-2.5.10.jar:2.0.1]
    at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:70) ~[dubbo-2.5.10.jar:2.0.1]
    at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:51) ~[dubbo-2.5.10.jar:2.0.1]
    at com.alibaba.dubbo.common.bytecode.proxy14.getOne(proxy14.java) ~[dubbo-2.5.10.jar:2.0.1]
    at com.baomidou.springboot.controller.user.FrontUserController.login(FrontUserController.java:152) ~[classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) ~[spring-web-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) ~[spring-webmvc-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:849) ~[spring-webmvc-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:760) ~[spring-webmvc-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) ~[spring-webmvc-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) ~[spring-webmvc-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) ~[spring-webmvc-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) ~[tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.5.37.jar:8.5.37]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.37.jar:8.5.37]
    at com.baomidou.springboot.filter.XssFilter.doFilter(XssFilter.java:57) ~[classes/:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109) ~[spring-web-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.22.RELEASE.jar:4.3.22.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) ~[tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) [tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800) [tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806) [tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) [tomcat-embed-core-8.5.37.jar:8.5.37]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.37.jar:8.5.37]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_112]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_112]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.37.jar:8.5.37]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_112]

提供服务端:

java.io.InvalidClassException: com.baomidou.mybatisplus.core.conditions.AbstractWrapper; local class incompatible: stream classdesc serialVersionUID = 3498576810672403439, local class serialVersionUID = 6780705936989990493
    at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:616)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1630)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1630)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1781)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
    at com.alibaba.dubbo.common.serialize.support.java.JavaObjectInput.readObject(JavaObjectInput.java:67)
    at com.alibaba.dubbo.common.serialize.support.java.JavaObjectInput.readObject(JavaObjectInput.java:73)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:106)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:68)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCodec.decodeBody(DubboCodec.java:128)
    at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:120)
    at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:81)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCountCodec.decode(DubboCountCodec.java:44)
    at com.alibaba.dubbo.remoting.transport.netty.NettyCodecAdapter$InternalDecoder.messageReceived(NettyCodecAdapter.java:133)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349)
    at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
[WARN ]19-04-26 15:22:09 0475 com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:71) [DUBBO] Decode rpc invocation failed: null, dubbo version: 2.0.1, current host: 192.168.14.51
java.io.EOFException
    at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2794)
    at java.io.ObjectInputStream.readByte(ObjectInputStream.java:919)
    at com.alibaba.dubbo.common.serialize.support.java.JavaObjectInput.readObject(JavaObjectInput.java:63)
    at com.alibaba.dubbo.common.serialize.support.java.JavaObjectInput.readObject(JavaObjectInput.java:73)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:116)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:68)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCodec.decodeBody(DubboCodec.java:128)
    at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:120)
    at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:81)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCountCodec.decode(DubboCountCodec.java:44)
    at com.alibaba.dubbo.remoting.transport.netty.NettyCodecAdapter$InternalDecoder.messageReceived(NettyCodecAdapter.java:133)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349)
    at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
[WARN ]19-04-26 15:22:09 0475 com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:125) [DUBBO] Skip input stream 2421, dubbo version: 2.0.1, current host: 192.168.14.51
[DEBUG]19-04-26 15:22:09 0503 com.alibaba.dubbo.remoting.transport.DecodeHandler.decode(DecodeHandler.java:58) [DUBBO] Decode decodeable message com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation, dubbo version: 2.0.1, current host: 192.168.14.51
[WARN ]19-04-26 15:22:09 0535 com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:109) [DUBBO] Decode argument failed: com.baomidou.mybatisplus.core.conditions.AbstractWrapper; local class incompatible: stream classdesc serialVersionUID = 3498576810672403439, local class serialVersionUID = 6780705936989990493, dubbo version: 2.0.1, current host: 192.168.14.51
java.io.InvalidClassException: com.baomidou.mybatisplus.core.conditions.AbstractWrapper; local class incompatible: stream classdesc serialVersionUID = 3498576810672403439, local class serialVersionUID = 6780705936989990493
    at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:616)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1630)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1630)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1781)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
    at com.alibaba.dubbo.common.serialize.support.java.JavaObjectInput.readObject(JavaObjectInput.java:67)
    at com.alibaba.dubbo.common.serialize.support.java.JavaObjectInput.readObject(JavaObjectInput.java:73)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:106)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:68)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCodec.decodeBody(DubboCodec.java:128)
    at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:120)
    at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:81)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCountCodec.decode(DubboCountCodec.java:44)
    at com.alibaba.dubbo.remoting.transport.netty.NettyCodecAdapter$InternalDecoder.messageReceived(NettyCodecAdapter.java:133)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349)
    at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
[WARN ]19-04-26 15:22:09 0535 com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:71) [DUBBO] Decode rpc invocation failed: null, dubbo version: 2.0.1, current host: 192.168.14.51
java.io.EOFException
    at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2794)
    at java.io.ObjectInputStream.readByte(ObjectInputStream.java:919)
    at com.alibaba.dubbo.common.serialize.support.java.JavaObjectInput.readObject(JavaObjectInput.java:63)
    at com.alibaba.dubbo.common.serialize.support.java.JavaObjectInput.readObject(JavaObjectInput.java:73)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:116)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:68)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCodec.decodeBody(DubboCodec.java:128)
    at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:120)
    at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:81)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCountCodec.decode(DubboCountCodec.java:44)
    at com.alibaba.dubbo.remoting.transport.netty.NettyCodecAdapter$InternalDecoder.messageReceived(NettyCodecAdapter.java:133)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349)
    at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
[WARN ]19-04-26 15:22:09 0536 com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:125) [DUBBO] Skip input stream 2421, dubbo version: 2.0.1, current host: 192.168.14.51
[DEBUG]19-04-26 15:22:09 0536 com.alibaba.dubbo.remoting.transport.DecodeHandler.decode(DecodeHandler.java:58) [DUBBO] Decode decodeable message com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation, dubbo version: 2.0.1, current host: 192.168.14.51
[WARN ]19-04-26 15:22:09 0543 com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:109) [DUBBO] Decode argument failed: com.baomidou.mybatisplus.core.conditions.AbstractWrapper; local class incompatible: stream classdesc serialVersionUID = 3498576810672403439, local class serialVersionUID = 6780705936989990493, dubbo version: 2.0.1, current host: 192.168.14.51
java.io.InvalidClassException: com.baomidou.mybatisplus.core.conditions.AbstractWrapper; local class incompatible: stream classdesc serialVersionUID = 3498576810672403439, local class serialVersionUID = 6780705936989990493
    at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:616)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1630)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1630)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1781)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
    at com.alibaba.dubbo.common.serialize.support.java.JavaObjectInput.readObject(JavaObjectInput.java:67)
    at com.alibaba.dubbo.common.serialize.support.java.JavaObjectInput.readObject(JavaObjectInput.java:73)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:106)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:68)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCodec.decodeBody(DubboCodec.java:128)
    at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:120)
    at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:81)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCountCodec.decode(DubboCountCodec.java:44)
    at com.alibaba.dubbo.remoting.transport.netty.NettyCodecAdapter$InternalDecoder.messageReceived(NettyCodecAdapter.java:133)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349)
    at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
[WARN ]19-04-26 15:22:09 0544 com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:71) [DUBBO] Decode rpc invocation failed: null, dubbo version: 2.0.1, current host: 192.168.14.51
java.io.EOFException
    at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2794)
    at java.io.ObjectInputStream.readByte(ObjectInputStream.java:919)
    at com.alibaba.dubbo.common.serialize.support.java.JavaObjectInput.readObject(JavaObjectInput.java:63)
    at com.alibaba.dubbo.common.serialize.support.java.JavaObjectInput.readObject(JavaObjectInput.java:73)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:116)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:68)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCodec.decodeBody(DubboCodec.java:128)
    at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:120)
    at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:81)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCountCodec.decode(DubboCountCodec.java:44)
    at com.alibaba.dubbo.remoting.transport.netty.NettyCodecAdapter$InternalDecoder.messageReceived(NettyCodecAdapter.java:133)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349)
    at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
qmdx commented 5 years ago

服务端什么样子,客户端什么样子贴出方便重现

funky-eyes commented 5 years ago

@qmdx 除了Controller,其它基本上都是代码生成工具生成,然后把service换为dubbo的service注解 客户端:

import com.alibaba.dubbo.config.annotation.Reference;
    @Reference(version = "1.0.0")
    IFrontUserSelectService selectUser;

执行代码:

    FrontUser userFrontUser = new FrontUser();
            userFrontUser.setMobileNum(user.getPhone());
            userFrontUser.setUserPass(MD5Util2.getStringMD5(user.getPassword()));
            QueryWrapper<FrontUser> ew = new QueryWrapper<FrontUser>();
            ew.setEntity(userFrontUser);
            userFrontUser = selectUser.getOne(ew);

yml:

dubbo:
  registry:
    id: my-registry
    address:  zookeeper://127.0.0.1:2181?client=curator
  application:
    name: dubbo-demo-client
    qos-enable: false

服务端: yml:

server:
  port: 8080
spring:
  datasource:
    dynamic:
      primary: master #设置默认的数据源或者数据源组,默认值即为master
      datasource:
        master:
          username: root
          password: 
          driver-class-name: com.mysql.jdbc.Driver
          url: 
        slave_1:
          username: root
          password: 
          driver-class-name: com.mysql.jdbc.Driver
          url: 
    dbcp2:
      initial-size: 6
      min-idle: 3
      max-wait-millis: 60000
      validation-query: select 'x'
      time-between-eviction-runs-millis: 60000
      soft-min-evictable-idle-time-millis: 30000
      test-on-borrow: false
      test-on-return: false
      test-while-idle: true
    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
dubbo:
  protocol:
      serialization: java
  scan:
    base-packages: com.example
  application:
    qos-enable: false
    name: testserver
  registry:
    id: my-registry
#    address:  zookeeper://172.17.0.2:2181?client=curator
    address:  zookeeper://127.0.0.1:2181?client=curator
mybatis-plus:
  mapper-locations: classpath:/mapper/*Mapper.xml
  typeAliasesPackage: com.baomidou.springboot.entity
  typeEnumsPackage: com.baomidou.springboot.entity.enums
  global-config:
    db-config:
      field-strategy: not-empty
      id-type: auto
      db-type: mysql
  configuration:
    map-underscore-to-camel-case: true
    cache-enabled: true   

service:

 import com.example.entity.FrontUser; 
import com.example.mapper.FrontUserMapper;
import com.example.service.IFrontUserSelectService;
import com.alibaba.dubbo.config.annotation.Service;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 前端用户表 服务实现类
 * </p>
 *
 * @author Funkye
 * @since 2019-04-10
 */
@Service(version = "1.0.0")
@Transactional
@DS("slave")
public class FrontUserSerlectServiceImpl extends ServiceImpl<FrontUserMapper, FrontUser>
        implements IFrontUserSelectService {

}
miemieYaho commented 5 years ago

不支持也不推荐把 wrapper 进行 dubbo 传输

funky-eyes commented 5 years ago

@miemieYaho 3.1.0前包括2.x都是支持的,现在突然不支持,让一直用的老用户如何升级?

miemieYaho commented 5 years ago

3.x 一直都不支持何来 3.1.0 前都支持?

funky-eyes commented 5 years ago

@miemieYaho 如果不支持3.1.0我是怎么用的好好的?

miemieYaho commented 5 years ago

那你就继续用 3.1.0 吧

funky-eyes commented 5 years ago

@miemieYaho 问题是你们一开始可以,后来不行呀,如果每一次迭代要让开发者去更改大量的业务代码您觉得合适吗?

miemieYaho commented 5 years ago

不好意思,我们从来就没有说过支持 dubbo 传值,你可以自己搜搜 issue 里面关于 dubbo 传值的报错有多少有多早.changelog 里面也没有说过任何修复的说明.而且我们以后也不会去支持 dubbo 传递

yuxiaobin commented 5 years ago

作为RPC服务,参数应该用明确的类型,而不应该用Wrapper/Map/JSON这种类型,可维护性差!!!

funky-eyes commented 5 years ago

@miemieYaho 哥,问题我反馈在这了,您可以去看下去年我发的问题,当时您没跟我说不支持,叫我升级版本,我升级版本后,一直可用,所以用到了3.1.1突然发现就不行了 https://github.com/baomidou/mybatis-plus/issues/475

funky-eyes commented 5 years ago

@yuxiaobin 是的,我已经决定要改了,谢谢指点

qmdx commented 5 years ago

这里统一解释下, mp 一开始就不打算支持 dubbo 序列化 wrapper 处于安全考虑, wrapper 的 sql 操作性太强,如果直接传递底层服务不可控。花点时间改下吧

Sidfate commented 5 years ago

@yuxiaobin 是的,我已经决定要改了,谢谢指点

@a364176773 如果确实有特殊需求需要传递wrapper,如接收方需要的条件查询比较多,我用java序列化成字节流然后接收方反序列化拿到了wrapper.

funky-eyes commented 5 years ago

@Sidfate 您好,我用的就是dubbo配置成java的序列化工具,在3.1.1以前的版本没有问题,到了3.1.1才出现,所以我怀疑只是dubbo的传输刚好引发了mp其中的一个bug,希望您看一下我的异常信息,看看是不是3.1.1存在其他的bug

Sidfate commented 5 years ago

@a364176773 我的意思不是配置dubbo的序列化方式,而是你传递的参数,改成byte[]方式传递,就是手动序列化和反序列化。

funky-eyes commented 5 years ago

@Sidfate 好的了解了,非常感谢

funky-eyes commented 5 years ago

@Sidfate 您好,我尝试了您建议的转换为byte[]后再转换为qw的对象后数据丢失了,就是qw里构造的条件全没了,异常信息是因为我getone结果有多条的错误,请问你能帮我看一下吗 这个是controller的接口代码

    @ApiOperation(value = "测试")
    @PostMapping(value = "testUser")
    public JsonResult testUser(@ApiParam(name = "id", value = "id", required = true) @RequestParam Integer id) {
        QueryWrapper<FrontUser> ew = new QueryWrapper<FrontUser>();
        ew.select("id").eq("id", id);
        logger.info(ew.getSqlSelect());
        return renderSuccess(selectUser.getOne(SerializableUtil.serialize(ew)));
    }

下面是远程调用的实现:

    @Override
    public FrontUser getOne(byte[] bytes) {
        // TODO Auto-generated method stub
        QueryWrapper<FrontUser> qw = (QueryWrapper<FrontUser>) SerializableUtil.unserialize(bytes);
        return getOne(qw);
    }

然后是序列化的工具类代码:

public class SerializableUtil {
    public static byte[] serialize(Object object) {
        ObjectOutputStream oos = null;
        ByteArrayOutputStream baos = null;
        try {
            // 序列化
            baos = new ByteArrayOutputStream();
            oos = new ObjectOutputStream(baos);
            oos.writeObject(object);
            byte[] bytes = baos.toByteArray();
            return bytes;
        } catch (Exception e) {

        }
        return null;
    }

    public static Object unserialize(byte[] bytes) {
        ByteArrayInputStream bais = null;
        try {
            // 反序列化
            bais = new ByteArrayInputStream(bytes);
            ObjectInputStream ois = new ObjectInputStream(bais);
            return ois.readObject();
        } catch (Exception e) {

        }
        return null;
    }
}
Sidfate commented 5 years ago

@a364176773 我也是这么转的,但是我没有问题,你的FrontUser是哪边提供的,还有dubbo接收方转出来的内容是什么。

funky-eyes commented 5 years ago

@Sidfate 您好,我是有一个公用api的项目的,provider跟消费者两边都是依赖了这个项目 一个是工具类一个是api,消费者跟提供者都是依赖于这个,api里是有个实体包里面就是放这些实体,frontuser等等,还有请问您dubbo接收的时候序列化用的默认的还是跟我 一样配置了个java序列化方式?

        <dependency>
            <groupId>together_api</groupId>
            <artifactId>together_api</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>together_util</groupId>
            <artifactId>together_util</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
funky-eyes commented 5 years ago

@Sidfate 您好,请问您也是3.1.1版本吗,还有我上面的问题可以帮忙看下吗

Sidfate commented 5 years ago

@a364176773

funky-eyes commented 5 years ago

@Sidfate 您好,我用的是3.11 dubbo2.5.10 3.0.6确实可以, 3.1.1就不行了

CoderPoet commented 5 years ago

mybatis-plus就做为单独的dao层把,还是需要自己封装一层dubbo service层的把?或者官方有木有dubbo+mybatis-plus的最佳实践可以Demo一下?