[英]Jenkins java.net.UnknownHostException Error
So when running a Jenkins job i'm getting the following error: 因此,当运行Jenkins作业时,我收到以下错误:
Unable to get host name
java.net.UnknownHostException: ip-XX-XX-XX-XXX: ip-XX-XX-XX-XXX: Name or service not known
I've read online about editing the /etc/hosts file. 我在网上看过有关编辑/ etc / hosts文件的内容。 Right now mine looks like 现在我看起来像
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost6 localhost6.localdomain6
I've done a lot of trail and error and have yet to find a solution that works. 我做了很多追踪和错误,还没有找到一个有效的解决方案。
At a guess your environment is trying to get the IP of the local machine from the hostname. 猜测你的环境正试图从主机名获取本地机器的IP。 AWS names hosts something like ip-172-30-1-34
by default but that value isn't in /etc/hosts. AWS名称默认包含类似ip-172-30-1-34
,但该值不在/ etc / hosts中。
A very quick fix would be to add the output from hostname
on the command line to /etc/hosts. 一个非常快速的解决方法是将命令行上hostname
的输出添加到/ etc / hosts。 As root, something like 作为根,像
echo "127.0.0.1 hostname" >> /etc/hosts
NOTE - the hostname above needs to be surrounded by backquotes but that character is also used by Stackoverflow - don't forget it. 注 - 上面的主机名需要被反引号包围,但Stackoverflow也使用该字符 - 不要忘记它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.