jps无法连接到远程jstatd [英] jps can't connect to a remote jstatd

查看:298
本文介绍了jps无法连接到远程jstatd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用jstatd使用jps查询远程JVM,以便最终使用VisualVM监视它。

I'm trying query a remote JVM with jps using jstatd, in order to eventually monitor it using VisualVM.

我使用以下安全策略运行jstatd:

I got jstatd running with the following security policy:

grant codebase "file:${java.home}/../lib/tools.jar" {

    permission java.security.AllPermission;
};

jstatd在64位Linux机器上运行,其中包含1.6.0_10版本的HotSpot vm。 jstatd命令是:

jstatd is running on a 64-bit Linux box with a 1.6.0_10 version HotSpot vm. The jstatd command is:

jstatd -J-Djava.security.policy=jstatd.tools.policy -J-Djava.rmi.server.logCalls=true

我正在尝试从Windows 7计算机运行jps。由于防火墙的限制,我正在通过SSH隧道将RMI数据隧道传送到我的Windows机器,这样jps命令行就是:

I'm trying to run jps from a Windows 7 machine. Due to firewall restrictions, I'm tunneling the RMI data through an SSH tunnel to my Windows machine such that the jps command line is:

 .\jps.exe -m -l rmi://localhost

当我运行jps时,我在jstatd日志中看到连接尝试,如下所示:

When I run jps, I see the connection attempt in the jstatd log, which looks like this:

Feb 1, 2011 11:50:34 AM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(3)-127.0.0.1: [127.0.0.1: sun.rmi.registry.RegistryImpl[0:0:0, 0]: java.rmi.Remote lookup(ja   va.lang.String)]

但是在jps方面,我得到以下内容错误:

but on the jps side I get the following error:

Error communicating with remote host: Connection refused to host: 192.168.1.137; nested exception is:
    java.net.ConnectException: Connection refused: connect

基于在jstatd日志中列出的连接尝试,我认为jps实际上已经到达主机,但由于某种原因被阻止。是否有我设置的安全策略或某些其他设置我可以更改以便我可以从远程jstatd获取jps来提取统计数据?

Based on the connection attempt listed in the jstatd log, I think jps is actually reaching the host, but for some reason is getting blocked. Is there some security policy I have set or some other setting somewhere I can change so that I can get jps to pull stats from the remote jstatd?

推荐答案

我的猜测是你只转发RMI注册表端口(1099),但你还需要打开另一个端口。

My guess is that you're only forwarding the RMI registry port (1099), but you need to also open another port.

检查哪些端口在偏远的一方

Check which ports on the remote side

# netstat -nap | grep jstatd

tcp        0      0 :::1099     :::*       LISTEN      453/jstatd          
tcp        0      0 :::58204    :::*       LISTEN      453/jstatd          

在这种情况下,您需要转发端口58204以及1099

In this case you will need to forward port 58204 as well as 1099

这篇关于jps无法连接到远程jstatd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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