Java 6是否为JMX远程连接打开了默认端口? [英] Does Java 6 open a default port for JMX remote connections?

查看:116
本文介绍了Java 6是否为JMX远程连接打开了默认端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的具体问题与JDK 1.6中使用的JMX有关:如果我使用JRE 1.6运行Java进程

My specific question has to do with JMX as used in JDK 1.6: if I am running a Java process using JRE 1.6 with

com.sun.management.jmxremote

在命令行中,Java是否选择了默认端口远程JMX连接?

in the command line, does Java pick a default port for remote JMX connections?

背景故事:我目前正在尝试开发一个程序,让客户能够通过JMX从远程连接到我们的一个进程机。目标是实现对实时显示控制台上发生的情况的远程调试。由于他们的服务级别协议,他们强烈要求尽可能多地捕获数据,如果情况看起来太复杂而无法快速修复,重新启动显示控制台并允许它重新连接到服务器端。

Backstory: I am currently trying to develop a procedure to give to a customer that will enable them to connect to one of our processes via JMX from a remote machine. The goal is to facillitate their remote debugging of a situation occurring on a real-time display console. Because of their service level agreement, they are strongly motivated to capture as much data as possible and, if the situation looks too complicated to fix quickly, to restart the display console and allow it to reconnect to the server-side.

我知道我可以运行 jconsole 关于JDK 1.6流程和 jvisualvm 在JDK 1.6.7之后的进程中,给予对控制台的物理访问。但是,由于操作要求和涉及的人员问题,我们强烈要求远程获取我们需要的数据并重新启动并运行。

I am aware the I could run jconsole on JDK 1.6 processes and jvisualvm on post-JDK 1.6.7 processes given physical access to the console. However, because of the operational requirements and people problems involved, we are strongly motivated to grab the data that we need remotely and get them up and running again.

编辑:我我知道命令行端口属性

I am aware of the command line port property

com.sun.management.jmxremote.port=portNum

我想回答的问题是,如果你没有在命令行设置该属性,Java会选择另一个端口吗?远程监控?如果是这样,你怎么能确定它可能是什么?

The question that I am trying to answer is, if you do not set that property at the command line, does Java pick another port for remote monitoring? If so, how could you determine what it might be?

推荐答案

文档表明JMX代理使用本地端口 - 无法访问的东西从机器外部 - 除非您指定以下属性:

The documentation suggests that the JMX agent uses a local port -- something unreachable from outside the machine -- unless you specify the following property:

com.sun.management.jmxremote.port = portNum

这是出于安全原因,以及Potato Head先生给出的理由。因此,看起来Java 6没有为JMX打开默认的远程可访问端口。

This is for security reasons, as well as for the reason given by Mr Potato Head. Thus, it looks like Java 6 does not open a default remotely accessible port for JMX.

编辑:在OP添加答案后添加更多信息。

Added after the OP added an answer with more information.

您拥有的另一个选择是以某种方式创建一个侦听所有本地JMX连接并导出此信息的本地代理。这样,您就不需要在服务器上具有每个JVM实例的这种神奇配置。相反,本地代理可以通过JMX连接到所有JVM,然后以某种方式远程公开此信息。我不确定你将如何实现这一点,但是这样的事情可能比通过JMX远程公开所有JVM所做的工作要少。

Another option you have is to somehow create a local proxy that listens to all local JMX connections and exports this information. This way, you don't need to have such magic configuration of each JVM instance on the server. Instead the local proxy can connect to all JVMs via JMX and then somehow expose this information remotely. I am not positive exactly how you would implement this, but something like this may be less work than what you otherwise have to do to expose all of your JVMs remotely via JMX.

这篇关于Java 6是否为JMX远程连接打开了默认端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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