Spring Boot:错误:代理抛出异常:java.net.MalformedURLException:本地主机名未知

时间:2017-12-22 23:37:41

标签: java linux spring spring-boot

我已经在Eclipse上安装了Spring Tool Suite(STS 3.9.2),我创建了一个Demo应用程序,但当我将它作为" Spring Boot App"我收到以下错误:

  

错误:代理抛出异常:java.net.MalformedURLException:本地主机名未知:java.net.UnknownHostException:linux-se15:linux-se15:名称或服务未知

运行此命令会产生以下结果:

127.0.0.1   localhost

# special IPv6 addresses
::1             localhost ipv6-localhost ipv6-loopback

fe00::0         ipv6-localnet

ff00::0         ipv6-mcastprefix
ff02::1         ipv6-allnodes
ff02::2         ipv6-allrouters
ff02::3         ipv6-allhosts

/ etc / hosts具有以下内容:

from itertools import product
print([x[0] * x[1] for x in product(a, b)])

1 个答案:

答案 0 :(得分:3)

问题的原因可能是主机主机名文件。 hosts文件应包含以下内容:

127.0.0.1       localhost
127.0.1.1       yourhostname

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

hostname文件应包含yourhostname 您可以使用sudo nano /etc/hostssudo nano /etc/hostname修改它们。