首页 > 代码库 > IntelliJ运行下载的Servlet时报错 Error running Tomcat 8.5.8: Unable to open debugger port (127.0.0.1:49551): java.net.SocketException

IntelliJ运行下载的Servlet时报错 Error running Tomcat 8.5.8: Unable to open debugger port (127.0.0.1:49551): java.net.SocketException

学习Java Servlet时,从Wrox上下载了示例代码,准备run/debug时发现以下错误:

 

Error running Tomcat 8.5.8: Unable to open debugger port (127.0.0.1:49551): java.net.SocketException "Socket closed"

技术分享

/Users/GuQiang/Tomcat/apache-tomcat-8.5.8/bin/catalina.sh stop
Using CATALINA_BASE: C:\Program Files\Apache Software Foundation\Tomcat 8.0
Unable to start as CATALINA_BASE contains a colon (:) character

技术分享

 

看了网上解释,大部分都说是端口号不对。

但是错误描述上分明写的CATALINA_BASE配置中有不能识别的 (:)

所以在Run/Debug Configuration中发现原有代码中有配置了特定的环境变量(Pass Environment Variable)

用MAC的人很容易就发现了问题。MAC下哪里来的C:\Programs Files...  :-(

技术分享

把这里的Pass environment variables去掉或修正即可。:-)

IntelliJ运行下载的Servlet时报错 Error running Tomcat 8.5.8: Unable to open debugger port (127.0.0.1:49551): java.net.SocketException