soul源碼地址:https://github.com/dromara/soul
今天來學習 Sofa 的演示。
調試了一晚上,啥也沒調通。Ծ‸Ծ
分割線
梳理了昨晚調試的思路。今天重新來。
- 清空頁面關於dubbo與sofa的配置。
- 按順序啓動 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