Soul网关第四天- 演示Sofa RPC应用示例

soul源码地址:https://github.com/dromara/soul

今天来学习 Sofa 的演示。

调试了一晚上,啥也没调通。Ծ‸Ծ


分割线 


梳理了昨晚调试的思路。今天重新来。

  1. 清空页面关于dubbo与sofa的配置。
  2. 按顺序启动 admin->application->dubbo->sofa

这时sofa的启动页面报错如下:

2021-01-19 22:05:58.407  INFO 2679 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'restTemplateBuilder' of type [org.springframework.boot.web.client.RestTemplateBuilder] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-01-19 22:05:58.523 ERROR 2679 --- [pool-1-thread-1] o.d.s.client.common.utils.RegisterUtils  : sofa client register error: {"appName":"sofa","contextPath":"/sofa","path":"/sofa/insert","pathDesc":"Insert a row of data","rpcType":"sofa","serviceName":"org.dromara.soul.examples.dubbo.api.service.DubboTestService","methodName":"insert","ruleName":"/sofa/insert","parameterTypes":"org.dromara.soul.examples.dubbo.api.entity.DubboTest","rpcExt":"{\"loadbalance\":\"hash\",\"retries\":3,\"timeout\":-1}","enabled":true} 
2021-01-19 22:05:58.535 ERROR 2679 --- [pool-1-thread-1] o.d.s.client.common.utils.RegisterUtils  : sofa client register error: {"appName":"sofa","contextPath":"/sofa","path":"/sofa/findById","pathDesc":"Find by Id","rpcType":"sofa","serviceName":"org.dromara.soul.examples.dubbo.api.service.DubboTestService","methodName":"findById","ruleName":"/sofa/findById","parameterTypes":"java.lang.String","rpcExt":"{\"loadbalance\":\"hash\",\"retries\":3,\"timeout\":-1}","enabled":true} 
2021-01-19 22:05:58.545 ERROR 2679 --- [pool-1-thread-1] o.d.s.client.common.utils.RegisterUtils  : sofa client register error: {"appName":"sofa","contextPath":"/sofa","path":"/sofa/findAll","pathDesc":"Get all data","rpcType":"sofa","serviceName":"org.dromara.soul.examples.dubbo.api.service.DubboTestService","methodName":"findAll","ruleName":"/sofa/findAll","parameterTypes":"","rpcExt":"{\"loadbalance\":\"hash\",\"retries\":3,\"timeout\":-1}","enabled":true} 

这表示sofa接口没有注册到项目中。

这时查看页面,当前接口数据确实没展示:

为了一探究竟,我们重启启动sofa。

根根打印信息,我们在注册位置打上断点查看,得到debug结果如图所示:

哦豁,系统 is busy!!!

 

为啥busy了?

原来系统有个设置:

 @ExceptionHandler(Exception.class)
    @ResponseBody
    protected SoulAdminResult serverExceptionHandler(final Exception exception) {
        log.error(exception.getMessage(), exception);
        String message;
        if (exception instanceof SoulException) {
            SoulException soulException = (SoulException) exception;
            message = soulException.getMessage();
        } else {
            message = "The system is busy, please try again later";
        }
        return SoulAdminResult.error(message);
    }

但我debug时,代码没走这里。o(╥﹏╥)o

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章