在linux 启动tomcat 时 ehcache报错 unknown localhost name;
解决方法如下:
查看hostname:
[root@BJS0-0WP-V bin]# hostnameBJS0-0WP-V
[root@BJS0-0WP-V bin]# hostname -i
未知的主机
在查看/etc/hosts
[root@BJS0-0WP-V bin]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
其中没有hostname的映射,导致找不到主机。
修改hosts文件,添加主机的hostname即可:
[root@BJS0-0WP-V bin]# vi /etc/hosts
127.0.0.1 BJS0-0WP-V localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6