MalformedURLException: unknown protocol: xxxxxxxxxx

直接 Http 调用的时候出现了异常,异常信息如下:

Caused by: java.net.MalformedURLException: unknown protocol: xxxxxxxxxx
	at java.net.URL.(URL.java:600)
	at java.net.URL.(URL.java:490)
	at java.net.URL.(URL.java:439)
	at java.net.URI.toURL(URI.java:1089)
	at org.springframework.http.client.SimpleClientHttpRequestFactory.createRequest(SimpleClientHttpRequestFactory.java:137)
	at org.springframework.http.client.support.HttpAccessor.createRequest(HttpAccessor.java:77)
	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:592)

信息很明显,没有协议,那么就需要加上协议:

request.getScheme()

 

你可能感兴趣的:(exception)