服务者本地跑没有问题,service可以调用到dao层的对象,不是空的,但是消费者调用服务者提供的接口时,服务端报错,service调用dao层对象时空的。服务方后部分报错信息如下:
2019-11-13 21:30:02,400 [main] DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Could not find key 'spring.liveBeansView.mbeanDomain' in any property source
2019-11-13 21:30:02,401 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'lifecycleProcessor'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.ChapterPracticeService'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.ChapterQuesAnswerService'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.ChapterScopeService'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.ChapterService'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.CourseService'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.DailyScoreService'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.PaperAnswerService'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.PaperQuestionService'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.PaperScoreService'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.PaperService'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.QuestionBankService'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.QuestionDailyAnswerService'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.QuestionDailyPracticeService'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.QuestionErrorService'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.QuestionTypeService'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.ShowPaperService'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.StudentService'
2019-11-13 21:30:02,402 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'com.soft.service.TeacherService'
2019-11-13 21:32:00,630 [DubboServerHandler-192.168.32.60:20880-thread-2] DEBUG [com.alibaba.dubbo.remoting.transport.DecodeHandler] -  [DUBBO] Decode decodeable message com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation, dubbo version: 2.5.2, current host: 127.0.0.1
服务提供者:这里是 addStudent方法
2019-11-13 21:32:00,634 [DubboServerHandler-192.168.32.60:20880-thread-2] ERROR [com.alibaba.dubbo.rpc.filter.ExceptionFilter] -  [DUBBO] Got unchecked and undeclared exception which called by 192.168.32.60. service: com.soft.service.StudentService, method: addStudent, exception: java.lang.NullPointerException: null, dubbo version: 2.5.2, current host: 127.0.0.1
java.lang.NullPointerException
at com.soft.service.impl.StudentServiceImpl.addStudent(StudentServiceImpl.java:30)
at com.alibaba.dubbo.common.bytecode.Wrapper33.invokeMethod(Wrapper33.java)
at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46)
at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72)
at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53)
at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:60)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:112)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:108)
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84)
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170)
at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52)
at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Student [id=null, stuName=张三, stuPasword=123456, corpId=null, createBy=zcz, createTime=Wed Nov 13 21:32:00 CST 2019, modifyBy=null, modifyTime=null, status=null, version=null]
服务提供者:studentMapper:null
2019-11-13 21:32:00,679 [New I/O server worker #1-1] WARN  [com.alibaba.dubbo.remoting.transport.AbstractServer] -  [DUBBO] All clients has discontected from /192.168.32.60:20880. You can graceful shutdown now., dubbo version: 2.5.2, current host: 127.0.0.1
2019-11-13 21:32:00,682 [DubboServerHandler-192.168.32.60:20880-thread-3] INFO  [com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol] -  [DUBBO] disconected from /192.168.32.60:51800,url:dubbo://192.168.32.60:20880/com.soft.service.ChapterPracticeService?anyhost=true&application=education_provider&channel.readonly.sent=true&codec=dubbo&default.group=dev-ljy&default.timeout=10000&default.version=1.0.0&dubbo=2.5.2&heartbeat=60000&interface=com.soft.service.ChapterPracticeService&methods=insertChapterPracticeByIf,insertErrorQuestion,selectChapterPracticeById,updateErrorQuestionByQuesId,selectErrorQuestionByQuesId,insertChapterScope&organization=comsoft&owner=ljy&pid=7276&side=provider&timestamp=1573651800586, dubbo version: 2.5.2, current host: 127.0.0.1
服务方service层代码片段:
消费方测试代码片段:
控制台截图:
服务方:
消费方: