在springboot 使用okhttp请求其他服务的接口时,出现了Address family not supported by protocol family: connect这个异常, 后来把这一块代码单独拎出去运行,是没有任何问题的。

后来在StackOverflow上找到了一个可用的解决方案,具体为什么只在springboot环境下出现异常暂时还不太清楚。

解决方法
VM options 追加参数: -Djava.net.preferIPv4Stack=true

IDEA下的VM options设置方法如下,其他环境请自行百度。
Address family not supported by protocol family: connect 解决方案

转自stackoverflow–Address family not supported by protocol family - SocketException on a specific computer

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
  • 2021-12-07
  • 2021-10-14
  • 2022-01-22
猜你喜欢
  • 2021-09-17
  • 2021-06-16
  • 2021-10-10
  • 2022-12-23
  • 2021-12-16
  • 2021-08-24
相关资源
相似解决方案