WGCLOUD服务端日志打印错误:
2022-07-31 00:10:05.005 [http-nio-9999-exec-2] ERROR com.wgcloud.util.RestUtil - 请求守护进程信息错误
org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:9997": Connect to localhost:9997 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect; 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: connect
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:785)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:711)
at org.springframework.web.client.RestTemplate.getForEntity(RestTemplate.java:361)
at com.wgcloud.util.RestUtil.get(RestUtil.java:186)
at com.wgcloud.controller.LicenseController.getDaemon(LicenseController.java:57)
at jdk.internal.reflect.GeneratedMethodAccessor380.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
错误原因
可能是守护进程(wgcloud-daemon-release)没有运行,或被关闭了,我们查看下守护进程是不是在运行中
解决办法
重启下server就好了,看下守护进程启动了没,启动了就好了,不会有这个错误了
还有一种可能是localhost不能访问,我们可以把server配置文件(server/config/application.yml)中的配置项daemonUrl改成ip,把如下的localhost改成ip,然后重启下server
#守护进程访问url,server服务使用,agent不使用(一般保持默认即可)
daemonUrl: http://localhost:9997