java 将visualvm连接到websphere 7

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2253339/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 20:19:00  来源:igfitidea点击:

Connect visualvm to websphere 7

javawebspherevisualvm

提问by user271858

I am trying to get visualvm and websphere 7 to work together on my local windows desktop. I try to connect through JMX but no luck. Has anybody managed to get visialvm and websphere 7 to work and ow did you do it?

我试图让visualvm 和websphere 7 在我的本地Windows 桌面上协同工作。我尝试通过 JMX 进行连接,但没有成功。有没有人设法让 visialvm 和 websphere 7 工作,你做到了吗?

Regards FF

问候 FF

回答by user271858

I got it to work with the help of the VisualVM team in Praha (Thanks Tomas!):

我在布拉格的 VisualVM 团队的帮助下让它工作(感谢 Tomas!):

1) On the admin console (Click on Servers-> Server types-> WebSphere application servers-> server1-> Java and Process Management-> Process definition-> Java Virtual Machine), add the following line into the field of
Generic JVM Argument (note that the first system property is equal to
nothing and no equal sign for the second system property):

1) 在管理控制台(点击Servers-> Server types-> WebSphere application servers-> server1-> Java and Process Management-> Process definition-> Java Virtual Machine),在
Generic JVM Argument字段中添加以下行(请注意,第一个系统属性
等于空,第二个系统属性没有等号):

-Djavax.management.builder.initial= -Dcom.sun.management.jmxremote

2) Add or uncomment the following three lines in file /opt/IBM/ WebSphere/AppServer/java/jre/lib/management/management.properties (or / lib/management/management.properties):

2)在文件/opt/IBM/WebSphere/AppServer/java/jre/lib/management/management.properties(或/lib/management/management.properties)中添加或取消注释以下三行:

com.sun.management.jmxremote.port=3333
com.sun.management.jmxremote.authenticate=false
com.sun.management.jmxremote.ssl=false
com.sun.management.jmxremote.local.only=false

3) Connect VisualVM!

3)连接VisualVM!

回答by David

It is possible to set these parameters port, authenticate and ssl as JVM Arguments like -Dcom.sun.management.jmxremote.port=1300

可以将这些参数 port、authenticate 和 ssl 设置为 JVM 参数,例如 -Dcom.sun.management.jmxremote.port=1300

I have another issue: by using the mbean visualvm plugin I can not see any relevant Websphere mbean.

我还有另一个问题:通过使用 mbean visualvm 插件,我看不到任何相关的 Websphere mbean。

回答by Andreas Veithen

It depends on what you want to achieve and the constraints you have. What you need to know is that there are two MBean servers in WebSphere: in addition to the platform MBean server created automatically by the JRE, WebSphere also creates its own MBean server. Here are the two options you have:

这取决于您想要实现的目标以及您拥有的限制。您需要知道的是,WebSphere 中有两个 MBean 服务器:除了由 JRE 自动创建的平台 MBean 服务器之外,WebSphere 还创建了自己的 MBean 服务器。以下是您拥有的两个选项:

  1. Configure your WebSphere server as described in the answer given by user271858. This will allow you to connect to the platform MBean server. You will get access to the standard platform MBeans that provide process information (RAM, CPU, threads, etc.). On the other hand, you won't be able to access WebSphere's MBeans (implementing certain administrative actions, providing application metrics, etc.). You also need to be aware that by changing the configuration of the WebSphere server, you bypass WebSphere's security.

  2. Connect to WebSphere's MBean server. WebSphere supports several protocols to do that (mainly SOAP and RMI), but none of them is completely standard. This means that you will need to add some of the WebSphere libraries (namely the admin thin client) to VisualVM. It is probably possible to do that (It works with JConsole, so in principle it should be possible with VisualVM as well), but it's tricky, especially it you need to connect to a WebSphere server that has security enabled.

    A simpler option is to install the VisualWASplugin into VisualVM. It relies on an Open Source implementation of one of the proprietary WebSphere protocols and therefore doesn't require any additional WebSphere library.

    This will give you access to MBeans registered in WebSphere's MBean server, but not to the standard platform MBeans, i.e. the relevant parts (related to memory, CPU and threads) in VisualVM will be disabled. You can however cross-register the platform MBeans in WebSphere's MBean server, and the VisualWAS project provides a solution for this as well (in the form of a plugin to be installed into WebSphere). You will then have access to all features in VisualVM, and you don't need to bypass WebSphere's security.

  1. 按照 user271858 给出的答案中的描述配置您的 WebSphere 服务器。这将允许您连接到平台 MBean 服务器。您将可以访问提供进程信息(RAM、CPU、线程等)的标准平台 MBean。另一方面,您将无法访问 WebSphere 的 MBean(实施某些管理操作、提供应用程序指标等)。您还需要注意,通过更改 WebSphere 服务器的配置,您可以绕过 WebSphere 的安全性。

  2. 连接到 WebSphere 的 MBean 服务器。WebSphere 支持多种协议来实现这一点(主要是 SOAP 和 RMI),但它们都不是完全标准的。这意味着您需要将一些 WebSphere 库(即管理瘦客户端)添加到 VisualVM。这样做可能是可行的(它适用于 JConsole,所以原则上它也适用于 VisualVM),但它很棘手,尤其是您需要连接到启用了安全性的 WebSphere 服务器时。

    一个更简单的选择是将VisualWAS插件安装到 VisualVM 中。它依赖于一种专有 WebSphere 协议的开源实现,因此不需要任何额外的 WebSphere 库。

    这将允许您访问在 WebSphere 的 MBean 服务器中注册的 MBean,但不能访问标准平台 MBean,即 VisualVM 中的相关部分(与内存、CPU 和线程相关)将被禁用。但是,您可以在 WebSphere 的 MBean 服务器中交叉注册平台 MBean,VisualWAS 项目也为此提供了解决方案(以插件的形式安装到 WebSphere 中)。然后,您将可以访问 VisualVM 中的所有功能,而无需绕过 WebSphere 的安全性。