NutzCN Logo
问答 nutz的方法放在微服务报错
发布于 7天前 作者 joy092 90 次浏览 复制 上一个帖子 下一个帖子
标签:
com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method execute in the service cn.wizzer.app.store.modules.services.StoreMainService. Tried 3 times of the providers [192.168.1.28:13194] (1/1) from the registry 127.0.0.1:2181 on the consumer 192.168.1.28 using the dubbo version 2.6.2. Last error is: Failed to invoke remote method: execute, provider: dubbo://192.168.1.28:13194/cn.wizzer.app.store.modules.services.StoreMainService?anyhost=true&application=wk-nb-web-platform&check=false&dubbo=2.6.2&generic=false&interface=cn.wizzer.app.store.modules.services.StoreMainService&methods=updateWithVersion,data,insertRelation,insertWith,addDo,insertOrUpdate,dao,join,getSubGoodsClasses,getMaxId,getSubPath,query,count,getField,vDelete,list,execute,fetchx,getMap,updateAndIncrIfMatch,updateLinks,getEntityClass,fetchLinks,updateRelation,fastInsert,editDo,update,insert,insertLinks,getParentPath,delete,updateIgnoreNull,clear,getEntity,updateWith,fetch,exists,listPage&pid=9072&register.ip=192.168.1.28&remote.timestamp=1536741120191&side=consumer&timestamp=1536741249823, cause: Failed to send message Request [id=369, version=2.0.0, twoway=true, event=false, broken=false, data=RpcInvocation [methodName=execute, parameterTypes=[interface org.nutz.dao.sql.Sql], arguments=[select main.id,main.storeName storename,user.loginname,main.levelId,main.typeId,class.name classname,level.name levelname,type.name typename,main.logo,main.storeProvince storeprovince,main.storeCity storecity,main.disabled from store_main main left join store_class as class on main.classId = class.id left join store_level as level on main.levelId = level.id left join store_type as type on main.typeId = type.id left join account_user as user on main.id = user.accountId ], attachments={path=cn.wizzer.app.store.modules.services.StoreMainService, interface=cn.wizzer.app.store.modules.services.StoreMainService, version=0.0.0}]] to /192.168.1.28:13194, cause: Serialized class org.nutz.dao.impl.sql.callback.QueryRecordCallback must implement java.io.Serializable
 Java field: protected org.nutz.dao.sql.SqlCallback org.nutz.dao.impl.sql.NutSql.callback
	at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:102)
	at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:238)
	at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:75)
	at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:52)
	at com.alibaba.dubbo.common.bytecode.proxy4.execute(proxy4.java)
	at cn.wizzer.app.web.modules.controllers.platform.store.StoreMainController.data(StoreMainController.java:142)
	at cn.wizzer.app.web.modules.controllers.platform.store.StoreMainController$FM$data$47b223be8bc4baa1e27699d1a123781a.invoke(StoreMainController.java)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:38)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at cn.wizzer.app.web.commons.processor.XssSqlFilterProcessor.process(XssSqlFilterProcessor.java:35)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at cn.wizzer.app.web.commons.processor.NutShiroProcessor.process(NutShiroProcessor.java:52)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at cn.wizzer.app.web.commons.processor.GlobalsSettingProcessor.process(GlobalsSettingProcessor.java:52)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at cn.wizzer.app.web.commons.processor.LogTimeProcessor.process(LogTimeProcessor.java:21)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
	at cn.wizzer.app.web.commons.filter.RouteFilter.doFilter(RouteFilter.java:31)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
	at org.nutz.mvc.WhaleFilter.doFilter(WhaleFilter.java:171)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)
	at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:215)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.server.Server.handle(Server.java:503)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
	at java.lang.Thread.run(Thread.java:745)
Caused by: com.alibaba.dubbo.remoting.RemotingException: Failed to send message Request [id=369, version=2.0.0, twoway=true, event=false, broken=false, data=RpcInvocation [methodName=execute, parameterTypes=[interface org.nutz.dao.sql.Sql], arguments=[select main.id,main.storeName storename,user.loginname,main.levelId,main.typeId,class.name classname,level.name levelname,type.name typename,main.logo,main.storeProvince storeprovince,main.storeCity storecity,main.disabled from store_main main left join store_class as class on main.classId = class.id left join store_level as level on main.levelId = level.id left join store_type as type on main.typeId = type.id left join account_user as user on main.id = user.accountId ], attachments={path=cn.wizzer.app.store.modules.services.StoreMainService, interface=cn.wizzer.app.store.modules.services.StoreMainService, version=0.0.0}]] to /192.168.1.28:13194, cause: Serialized class org.nutz.dao.impl.sql.callback.QueryRecordCallback must implement java.io.Serializable
 Java field: protected org.nutz.dao.sql.SqlCallback org.nutz.dao.impl.sql.NutSql.callback
	at com.alibaba.dubbo.remoting.transport.netty.NettyChannel.send(NettyChannel.java:110)
	at com.alibaba.dubbo.remoting.transport.AbstractClient.send(AbstractClient.java:265)
	at com.alibaba.dubbo.remoting.transport.AbstractPeer.send(AbstractPeer.java:53)
	at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeChannel.request(HeaderExchangeChannel.java:115)
	at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeClient.request(HeaderExchangeClient.java:90)
	at com.alibaba.dubbo.rpc.protocol.dubbo.ReferenceCountExchangeClient.request(ReferenceCountExchangeClient.java:83)
	at com.alibaba.dubbo.rpc.protocol.dubbo.DubboInvoker.doInvoke(DubboInvoker.java:95)
	at com.alibaba.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:148)
	at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at com.alibaba.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:54)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at com.alibaba.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:48)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at com.alibaba.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:77)
	at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56)
	at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:78)
	... 78 more
Caused by: java.lang.RuntimeException: Serialized class org.nutz.dao.impl.sql.callback.QueryRecordCallback must implement java.io.Serializable
 Java field: protected org.nutz.dao.sql.SqlCallback org.nutz.dao.impl.sql.NutSql.callback
	at com.alibaba.com.caucho.hessian.io.JavaSerializer$FieldSerializer.serialize(JavaSerializer.java:300)
	at com.alibaba.com.caucho.hessian.io.JavaSerializer.writeInstance(JavaSerializer.java:280)
	at com.alibaba.com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:247)
	at com.alibaba.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:391)
	at com.alibaba.dubbo.common.serialize.hessian2.Hessian2ObjectOutput.writeObject(Hessian2ObjectOutput.java:88)
	at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCodec.encodeRequestData(DubboCodec.java:176)
	at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.encodeRequest(ExchangeCodec.java:234)
	at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.encode(ExchangeCodec.java:71)
	at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCountCodec.encode(DubboCountCodec.java:38)
	at com.alibaba.dubbo.remoting.transport.netty.NettyCodecAdapter$InternalEncoder.encode(NettyCodecAdapter.java:80)
	at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:66)
	at com.alibaba.dubbo.remoting.transport.netty.NettyHandler.writeRequested(NettyHandler.java:98)
	at org.jboss.netty.channel.Channels.write(Channels.java:611)
	at org.jboss.netty.channel.Channels.write(Channels.java:578)
	at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:251)
	at com.alibaba.dubbo.remoting.transport.netty.NettyChannel.send(NettyChannel.java:100)
	... 94 more
Caused by: java.lang.IllegalStateException: Serialized class org.nutz.dao.impl.sql.callback.QueryRecordCallback must implement java.io.Serializable
	at com.alibaba.com.caucho.hessian.io.SerializerFactory.getDefaultSerializer(SerializerFactory.java:395)
	at com.alibaba.com.caucho.hessian.io.SerializerFactory.getSerializer(SerializerFactory.java:369)
	at com.alibaba.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:389)
	at com.alibaba.com.caucho.hessian.io.JavaSerializer$FieldSerializer.serialize(JavaSerializer.java:298)
	... 109 more
        StringBuilder sb = new StringBuilder("select main.id,main.storeName storename,user.loginname,main.levelId,main.typeId,class.name classname,level.name levelname,type.name typename,main.logo,main.storeProvince storeprovince,main.storeCity storecity,main.disabled " +
                "from store_main main left join store_class as class on main.classId = class.id left join store_level as level on main.levelId = level.id " +
                "left join store_type as type on main.typeId = type.id left join account_user as user on main.id = user.accountId $condition ");





        //列表分页数据
        Sql sql = Sqls.queryRecord(sb.toString());
        sql.setCondition(cnd);
        sql.setPager(pager);
        storeMainService.execute(sql);
        List<Store> storeList = sql.getList(Store.class);
5 回复

不要调用service的dao底层方法,要封装成业务方法

StringBuilder sb = new StringBuilder("select main.id,main.storeName storename,user.loginname,main.levelId,main.typeId,class.name classname,level.name levelname,type.name typename,main.logo,main.storeProvince storeprovince,main.storeCity storecity,main.disabled " +
                "from store_main main left join store_class as class on main.classId = class.id left join store_level as level on main.levelId = level.id " +
                "left join store_type as type on main.typeId = type.id left join account_user as user on main.id = user.accountId $condition ");
        //列表分页数据
        Sql sql = Sqls.queryRecord(sb.toString());
        sql.setCondition(cnd);
        sql.setPager(pager);
        storeMainService.execute(sql);
        List<Store> storeList = sql.getList(Store.class);

把这块代码封装起来,控制层去调吗?execute这个方法直接用service的this.dao()去调吗?

封装成业务方法,不要直接调用serivce类的dao/sql方法

谢谢大神,问题解决啦!

添加回复
请先登陆
回到顶部