tomcat无法连接本地服务器问题

更新系统后IDEA下启动项目失败,报错:

/Users/****/tomcat/tomcat-7.0.70/bin/catalina.sh run
Connected to the target VM, address: '127.0.0.1:57716', transport: 'socket'
[2016-11-05 11:53:04,930] Artifact ****:war exploded: Server is not connected. Deploy is not available.
??: ????????: java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: ****MacBook-Pro.local: ****MacBook-Pro.local: nodename nor servname provided, or not known
Disconnected from server
Disconnected from the target VM, address: '127.0.0.1:57716', transport: 'socket'

看错误信息似乎是不知道域名“****MacBook-Pro.local”对应的地址是多少,虽然暂时不知道为什么不是localhost,但既然他不知道就告诉他先。

编辑配置文件,需要sudo的权限才行

sudo vim /etc/hosts

发现里面各种 IP 域名

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost

127.0.0.1    ******0

#随便找个空位加上这个,告诉他这个域名地址是本机,*号为手动打码
127.0.0.1   ****MacBook-Pro.local

127.0.0.1   ******6
127.0.0.1   *******.com

把那个tomcat找不到的地址加进去就行了

PS:虽然这个问题解决了但项目还没跑起来,为什么要作死升系统!!!

评论

h
hw_7864

⭐️ Admin快速开发: https://show.cool-admin.com/

赞 0
h
hw_7864

⭐️ 官方文档: https://cool-js.com

赞 0
h
hw_7864

⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld

赞 0