无法远程调试应用程序-无法从外部访问端口 [英] Unable to debug app remotely - port isn't accessible externally

查看:0
本文介绍了无法远程调试应用程序-无法从外部访问端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要远程调试我的应用程序,但由于以下错误,我无法执行此操作:

Unable to open debugger port (X.X.X.X:8000): java.net.ConnectException "Connection timed out: connect"

我有:

  1. 在远程服务器上的Tomcat中运行的Java应用程序(Debian)
  2. 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>

这篇关于无法远程调试应用程序-无法从外部访问端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆