Java远程调试(JPDA)在Tomcat 9中对我不起作用 [英] Java remote debugging (JPDA) not working for me in Tomcat 9

查看:530
本文介绍了Java远程调试(JPDA)在Tomcat 9中对我不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在最近升级的Tomcat 9.0.13和Open JDK 11.0.1上远程调试Tomcat Web应用程序.服务器是Redhat Enterprise Linux 7.6,我正在Windows 7开发人员盒上使用Eclipse进行连接.

I'm trying to remotely debug a Tomcat webapp on a recently upgraded Tomcat 9.0.13 and Open JDK 11.0.1. Server is Redhat Enterprise Linux 7.6 and I'm using Eclipse on a Windows 7 developer box to connect.

Tomcat启动,并且可以在端口8080上访问该应用程序,但在某些请求上失败.因此,在Eclipse上,我已经使用自己的配置详细信息配置了Remote Java应用程序.当我尝试连接到它时,连接失败,显示为

Tomcat starts, and the app is accessible on port 8080 but fails on certain requests. So on my Eclipse, I've configured a Remote Java application with my configuration details. When I try to connect to it, the connecting fails with

Failed to connect to remote VM. Connection refused.

我使用的是默认端口8000,在Linux服务器上,netstat -an显示有一个进程在Tomcat启动时侦听该端口,而在Tomcat停止时侦听该端口.

I'm using the default port, 8000 and on the Linux server, netstat -an shows that there is a process listening on that port when Tomcat starts and not when Tomcat stops.

我已经尝试从Windows框中将telnet连接到端口8000并获得

I've tried telnet from the Windows box to port 8000 and get

$ telnet c516vefpubrec 8000
Trying XX.XXX.XX.XX...
telnet: Unable to connect to remote host: Connection refused

当我运行旧的Tomcat 7 + Java 1.8进行相同操作时,一切都成功了.我试过其他端口,结果相同.

When I do the same running our old Tomcat 7 + Java 1.8 everything is successful. I've tried other ports with the same result.

这可能是错误吗?是否有配置项可在Tomcat 9上启用JPDA?

Could this be a bug? Is there a configuration item to enable JPDA on Tomcat 9?

推荐答案

我遇到了完全相同的问题.我正在从centos vm运行应用程序,并尝试从Windows计算机进行调试.

I had this exact same issue. I'm running an application from a centos vm and trying to debug from my windows machine.

我必须进入vm上的catalina.sh文件并进行编辑. 在处理jpda标志的部分中,需要将JPA_OPTS变量更改为JPDA_OPTS="-agentlib:jdwp=transport=$JPDA_TRANSPORT,address=*:$JPDA_ADDRESS,server=y,suspend=$JPDA_SUSPEND"

I had to go into the catalina.sh file on the vm and make an edit. In the section that says that handles the jpda flag, the JPA_OPTS variable needed to be changed to JPDA_OPTS="-agentlib:jdwp=transport=$JPDA_TRANSPORT,address=*:$JPDA_ADDRESS,server=y,suspend=$JPDA_SUSPEND"

在JPDA变量之前注意*:.这允许任何IP地址都可以访问远程调试.我相信默认情况下它仅允许本地主机.

Note the *: before the JPDA variable. This allows any ip address to have access to remote debugging. I believe by default it only allows local host.

希望这会有所帮助.

这篇关于Java远程调试(JPDA)在Tomcat 9中对我不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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