nacos: Caused by: java.net.UnknownHostException: jmenv.tbsite.net
Describe what you expected to happen
启动时nacos.log 出现了如下异常:
Caused by: com.alibaba.nacos.api.exception.NacosException: java.net.UnknownHostException: jmenv.tbsite.net
at com.alibaba.nacos.core.cluster.lookup.AddressServerMemberLookup.run(AddressServerMemberLookup.java:110)
at com.alibaba.nacos.core.cluster.lookup.AddressServerMemberLookup.start(AddressServerMemberLookup.java:66)
at com.alibaba.nacos.core.cluster.ServerMemberManager.initAndStartLookup(ServerMemberManager.java:156)
at com.alibaba.nacos.core.cluster.ServerMemberManager.init(ServerMemberManager.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)
... 111 common frames omitted
Caused by: java.net.UnknownHostException: jmenv.tbsite.net
at java.net.InetAddress.getAllByName0(InetAddress.java:1281)
at java.net.InetAddress.getAllByName(InetAddress.java:1193)
at java.net.InetAddress.getAllByName(InetAddress.java:1127)
at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:111)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
at com.alibaba.nacos.common.http.BaseHttpClient.execute(BaseHttpClient.java:45)
at com.alibaba.nacos.common.http.NacosSyncHttpClient.get(NacosSyncHttpClient.java:46)
at com.alibaba.nacos.core.cluster.lookup.AddressServerMemberLookup.syncFromAddressUrl(AddressServerMemberLookup.java:155)
at com.alibaba.nacos.core.cluster.lookup.AddressServerMemberLookup.run(AddressServerMemberLookup.java:101)
... 121 common frames omitted
From the above code, I can know that jmenv.tbsite.net has no configuration mapping in the host file. But I just start nacos locally, why should I map this domain name?
By the way, it’s ok on win7. the same config.
以上代码我可以得知,jmenv.tbsite.net 在host文件中没有配置映射。但是我只是本地启动一个nacos,为什么要映射这个域名?
相同配置在windows7上可正常运行
Tell us your environment
Linux version 4.19.0-8-amd64 (debian-kernel@lists.debian.org) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.98-1 (2020-01-26)
java version “1.8.0_251”
nacos-server-1.3.0-BETA
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 32
@xuw027 有用。
下载下来, application.properties 要配资数据库; 指定JAVA_HOME环境 (或者修改startup.sh); 另外拷贝一份cluster.conf.sample出来–> cluster.conf。
希望后面的兄弟不要再踩坑浪费时间,官方也完善一下稳定、默认配置。
复制nacos/conf/cluster.conf.example 到nacos/conf/cluster.conf 设置ip和端口 重启服务 我修改的配置如下: #it is ip #example 192.168.0.103:884
关注我的简书:https://www.jianshu.com/p/8a795ff74aeb 获取答案。
在startuo.cmd 里面28行 改成单机模式就行了
如果是ide启动的话,可以在ide的vm配置增加:-Dnacos.standalone=true
查看启动脚本的时候可以看到这个配置
正解。在cluster.conf里加个ip就行了
说出来可能不信,太沙雕的错误了。conf中只给了一个cluster.conf.example文件,需要copy成一个cluster.conf文件再修改。
你好,我今天同样遇见了这个问题。我在搭建nacos集群,使用外部mysql数据库作为数据源。 按照官网给的文档 https://nacos.io/zh-cn/docs/cluster-mode-quick-start.html 下的描述 Stand-alone mode 是单机模式,启动时指定参数
sh startup.sh -m standalone
在集群模式下,使用内置数据源则需要
sh startup.sh -p embedded
那么使用外置数据源则是
sh startup.sh
即可,那么想来不指定启动模式则默认启动集群外置数据源我今天遇到的是在集群模式下,使用外置mysql数据源,遇见了这个问题
我确认hostname在hosts中存在且没有问题,指定端口启动端口设置没有问题,但是还是遇见了这个报错
Caused by: com.alibaba.nacos.api.exception.NacosException: java.net.UnknownHostException: jmenv.tbsite.net
请问有什么好的解决思路吗?By the way, it’s ok on win7. the same config.