一.异常提示
192.168.54.6/api/vsns.json org.apache.http.client.ClientProtocolException at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:187) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108) at com.qjzh.edge.klt.screen.utils.HttpClient.doGet(HttpClient.java:53) at com.qjzh.edge.klt.screen.utils.HttpClient.doGet(HttpClient.java:31) at com.qjzh.edge.klt.screen.converter.ScreenConverter.main(ScreenConverter.java:636) Caused by: org.apache.http.ProtocolException: Target host is not specified at org.apache.http.impl.conn.DefaultRoutePlanner.determineRoute(DefaultRoutePlanner.java:71) at org.apache.http.impl.client.InternalHttpClient.determineRoute(InternalHttpClient.java:125) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) ... 5 more null
二、问题定位
Target host is not specified指目标主机未指定,因项目中使用到HttpClient,故与HttpClient的使用有关.
HttpGet httpGet = new HttpGet(uri);
httpResponse = client.execute(httpGet);
三、解决方案
拼接url请求时没有加上 **http://**请求头即可
http://192.168.54.6/api/vsns.json
{"contents":[{"content":[{"ableToEdit":false,"lastModifiedTime":1648811003000,"md5":"","name":"154.vsn","publishedmd5":"","size":6276091}],"type":"lan"},{"content":[],"ressize":0,"type":"internet","unused":0}],"playing":{"name":"154.vsn","type":"lan"}}



