本文介绍了无法远程调试应用程序-无法从外部访问端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要远程调试我的应用程序,但由于以下错误,我无法执行此操作:
Unable to open debugger port (X.X.X.X:8000): java.net.ConnectException "Connection timed out: connect"
我有:
-
在远程服务器上的Tomcat中运行的Java应用程序(Debian)
IntelliJ Idea在本地运行(Windows)
我得出的结论是,问题的原因是用于远程调试的端口8000无法通过外部IP访问,只能通过‘localhost’访问。以下是我认为是这样的原因:
远程调试正在预期的端口上进行:
root@victor-app-server:/opt/tomcat-home/bin# netstat -tulpn | grep 8000
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 3773/java
我能够通过‘localhost’远程登录到它:
root@victor-app-server:/opt/tomcat-home/bin# telnet localhost 8000
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.
但无法通过外部IP远程登录:
root@victor-app-server:/opt/tomcat-home/bin# telnet X.X.X.X 8000
Trying X.X.X.X...
telnet: Unable to connect to remote host: Connection timed out
以下是ipables的输出:
root@victor-app-server:/opt/tomcat-home/bin# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
如何使用8000端口解决此问题?或者我的主要问题可能有其他原因?
推荐答案
这是为我完成任务的命令:
sudo ufw allow <debug_port>
这篇关于无法远程调试应用程序-无法从外部访问端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。