C3P0在Linux下的Failed to get local InetAddress for VMID解决方法
com.mchange.v2.c3p0.impl.C3P0ImplUtils generateVmId信息: Failed to get local InetAddress for VMID. This is unlikely to matter. At all. We'll add some extra randomnessjava.net.UnknownHostException: Alo
·
com.mchange.v2.c3p0.impl.C3P0ImplUtils generateVmId
信息: Failed to get local InetAddress for VMID. This is unlikely to matter. At all. We'll add some extra randomness
java.net.UnknownHostException: Along.Fedora: Along.Fedora
at java.net.InetAddress.getLocalHost(InetAddress.java:1353)
at com.mchange.v2.c3p0.impl.C3P0ImplUtils.generateVmId(C3P0ImplUtils.java:120)
at com.mchange.v2.c3p0.impl.C3P0ImplUtils.<clinit>(C3P0ImplUtils.java:98)
at com.mchange.v2.c3p0.impl.PoolBackedDataSourceBase.<init>(PoolBackedDataSourceBase.java:227)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.<init>(AbstractPoolBackedDataSource.java:62)
at com.mchange.v2.c3p0.ComboPooledDataSource.<init>(ComboPooledDataSource.java:109)
at com.mchange.v2.c3p0.ComboPooledDataSource.<init>(ComboPooledDataSource.java:105)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)
主要是因为系统没有找到主机名Along.Fedora对应的IP,修改Linux的host文件即可。
具体操作步骤如下:
vi /etc/hosts
在行127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4后加上 Along.Fedora保存即可。
Linux查找域名时通常指先查找文件/etc/hosts,找不到时再向DNS服务器请求。
Linux于host相关的几个文件如下:
/etc/host.conf
功能:指定主机名查找方法,通常指先查找文件/etc/hosts,找不到时再向DNS服务器请求。
对于大多数用户不用改动此文件内容。
Linux: /etc/host.conf文件内容
order hosts, bind
multi on
/etc/resolv.conf
文件功能:DNS客户机配置文件,设置DNS服务器的IP地址及DNS域名
相关文件:/etc/host.conf
文件格式:
domainname 域名
search 域名
nameserver Primary_DNS_Server_IP_address
nameserver Second_DNS_Server_IP_address
其中domainname和search可同时存在,也可只有一个;nameserver可指定多个
/etc/hosts
#/etc/hosts
#文件格式: IPaddress hostname aliases
#文件功能: 提供主机名到IP地址的对应关系,建议将自己经常使用的主机
# 加入此文件中,也可将没有DNS记录的机器加入到此文件中,
# 这样会方便网络应用
127.0.0.1 localhost localhost.localdomain
更多推荐
已为社区贡献1条内容
所有评论(0)