java報錯--java.io.IOException: Server returned HTTP response code: 502

java.io.IOException: Server returned HTTP response code: 502 for URL: http://ip.taobao.com/service/getIpInfo.php?ip=219.xxx.xxx.xxx

通過淘寶ip庫獲取ip地址和地理位置報錯502

原因:淘寶獲取IP地址的接收,有時候會不穩定。(總的來說就是淘寶IP庫有時候會不穩定)

解決辦法:暫時沒時間找

暫時解決辦法:配置中關閉addressEnabled,addressEnabled=false,或者更換爲離線IP~

RROR com.association.common.utils.http.HttpUtils - 調用HttpUtils.sendPost IOException, url=http://ip.taobao.com/service/getIpInfo.php,param=ip=219.xxx.xxx.xxx
java.io.IOException: Server returned HTTP response code: 502 for URL: http://ip.taobao.com/service/getIpInfo.php?ip=219.xxx.xxx.xxxx
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1900)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
	at com.association.common.utils.http.HttpUtils.sendPost(HttpUtils.java:112)
	at com.association.common.utils.ip.AddressUtils.getRealAddressByIP(AddressUtils.java:30)
	at com.association.manager.factory.AsyncFactory$1.run(AsyncFactory.java:48)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
2020-05-14 12:23:54.209 [schedule-pool-1] ERROR com.association.common.utils.ip.AddressUtils - 獲取地理位置異常 219.133.250.212
2020-05-14 12:23:54.234 [http-nio-8088-exec-26] ERROR c.association.web.exception.GlobalExceptionHandler - null
java.lang.NullPointerException: null
	at com.association.common.utils.ip.AddressUtils.getRealAddressByIP(AddressUtils.java:38)
	at com.association.security.service.TokenService.setUserAgent(TokenService.java:158)
	at com.association.security.service.TokenService.createToken(TokenService.java:110)
	at com.association.security.service.LoginService.login(LoginService.java:94)
	at com.association.web.system.controller.LoginController.login(LoginController.java:62)
	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)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章