Linux部署tomcat错误:java.net.UnknownHostException: localhost.localdomain: localhost.localdomain: unknow

,445 INFO  [localhost-startStop-1] annotation.ClassPathScanningCandidateComponentProvider (ClassPathScanningCandidateComponentProvider.java:231) - JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
 20 [MLog-Init-Reporter] INFO com.mchange.v2.log.MLog - MLog clients using slf4j logging.
 90 [localhost-startStop-1] INFO com.mchange.v2.uid.UidUtils - Failed to get local InetAddress for VMID. This is unlikely to matter. At all. We'll add some extra randomness
 java.net.UnknownHostException: localhost.localdomain: localhost.localdomain: unknown error
 	at java.net.InetAddress.getLocalHost(InetAddress.java:1484)
 	at com.mchange.v2.uid.UidUtils.generateVmId(UidUtils.java:70)
 	at com.mchange.v2.uid.UidUtils.<clinit>(UidUtils.java:54)
 	at com.mchange.v2.c3p0.impl.C3P0ImplUtils.<clinit>(C3P0ImplUtils.java:126)
 	at com.mchange.v2.c3p0.impl.PoolBackedDataSourceBase.<init>(PoolBackedDataSourceBase.java:288)
 	at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.<init>(AbstractPoolBackedDataSource.java:74)
 	at com.mchange.v2.c3p0.AbstractComboPooledDataSource.<init>(AbstractComboPooledDataSource.java:142)
 	at com.mchange.v2.c3p0.AbstractComboPooledDataSource.<init>(AbstractComboPooledDataSource.java:138)
 	at com.mchange.v2.c3p0.ComboPooledDataSource.<init>(ComboPooledDataSource.java:47)
 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 	at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
 	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
 	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1000)

http://blog.sina.com.cn/s/blog_6f3ef5c201012ddz.html

解决这个异常的方法是

主机映射的原因。

修改etc/hosts文件

用root用户登陆后

 [root@bogon ~]# vi /etc/hosts

   将看到如下代码:

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1            localhost.localdomain localhost

::1             localhost6.localdomain6 localhost6 

将以上代码修改成 也就是加个bogon

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1       bogon   localhost.localdomain localhost

::1             localhost6.localdomain6 localhost6

 

然后按ESC  冒号 wq 保存后退出 reboot 重启后生效。

问道解决。以上异常就不会出现了。一切OK了。

猜你喜欢

转载自blog.csdn.net/wsyzxss/article/details/83082692