WGCLOUD的server日志里经常出现这个错误信息,如下:
2022-02-10 12:17:06.006 [http-nio-19999-exec-5] ERROR com.wgcloud.util.RestUtil - 请求守护进程信息错误
org.springframework.web.client.ResourceAccessException: I/O error on GET request for "[http://localhost:9997](http://localhost:9997/)": Connect to localhost:9997 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused (Connection refused); nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:9997 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused (Connection refused)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:746)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:672)
at org.springframework.web.client.RestTemplate.getForEntity(RestTemplate.java:340)
at com.wgcloud.util.RestUtil.get(RestUtil.java:176)
at com.wgcloud.controller.LicenseController.getDaemon(LicenseController.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)
at
这是因为守护进程(wgcloud-daemon-release)可能被关闭了,
先./stop.sh,再./start.sh,就可以了
如果是server运行在windows上,启动wgcloud-daemon-release.exe就可以了
还有一种情况就是,可能server主机的localhost不能使用,我们把配置文件server/config/application.yml,里面如下配置项里的localhost改成server主机的ip就可以了,然后重启server
daemonUrl: http://localhost:9997