Unable to debug app remotely - port isn#39;t accessible externally(无法远程调试应用程序-无法从外部访问端口)
问题描述
我需要远程调试我的应用程序,但由于以下错误,我无法执行此操作:
我有: 我得出的结论是,问题的原因是用于远程调试的端口8000无法通过外部IP访问,只能通过‘localhost’访问。以下是我认为是这样的原因: 远程调试正在预期的端口上进行: 我能够通过‘localhost’远程登录到它: 但无法通过外部IP远程登录: 以下是ipables的输出:Unable to open debugger port (X.X.X.X:8000): java.net.ConnectException "Connection timed out: connect"
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
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.
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
如何使用8000端口解决此问题?或者我的主要问题可能有其他原因?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
推荐答案
这是为我完成任务的命令:
sudo ufw allow <debug_port>
这篇关于无法远程调试应用程序-无法从外部访问端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!