如何在 Websphere 中启用 JMX?

发布于 2024-07-10 06:40:31 字数 56 浏览 4 评论 0原文

我想使用 JConsole 来监视我的 Websphere 应用程序,但我不知道如何启用 JMX。

I would like to use JConsole to monitor my Websphere application, but I am not sure how to enable JMX.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(12

月下凄凉 2024-07-17 06:40:31

以下信息适用于 Windows 上的 Websphere 6.1。

首先,连接到 MBean 服务器的神奇 URL 是:

service:jmx:iiop://<host>:<port>/jndi/JMXConnector

如果您有默认的 Websphere 安装,JNDI 端口号可能是 2809、2810...,具体取决于一个系统上安装的服务器数量以及您想要连接的具体一个。 可以肯定的是,启动 Websphere 时,请检查日志,因为它会转储一行,如

0000000a RMIConnectorC A   ADMC0026I: The RMI Connector is available at port 2810

If you don't get this line, open the Websphere admin console 并转至

应用服务器> 服务器1>
行政服务> 吉米克斯
连接器

以查看是否需要添加或更改配置。

第二个重要的信息是,在使用服务器执行 JMX 时始终需要以下 JAR:

com.ibm.ws.admin.client_6.1.0.jar

您可以在 Websphere 的 runtime 目录中找到此 JAR。 无论您做什么,无论是通过编程方式访问 Websphere 上的 MBean,还是使用 JConsole 等等,都请使用神奇的 URL 并始终包含此 JAR。

对于本答案的其余部分,假设 Websphere 安装在 D:\prog\was61 中。

要运行 JConsole,请输入以下内容:

D:\prog\was61\java\bin>jconsole -J-Djava.class.path=d:\prog\was61\java\lib\tools.jar;D:\prog\was61\runtimes\com.ibm.ws.admin.client_6.1.0.jar

然后转到“高级”选项卡并输入神奇的 JMX URL。 按连接,您应该会看到 MBean 出现。

使用 Sun JDK 则完全是另一回事。 您需要一个额外的 JAR,该 JAR 位于 IBM JDK 的 lib 中,但不在 Sun 的 (ibmorb.jar) 中,也许以下命令可能对您有用:

C:\Program Files\Java\jdk1.5.0_11\bin>jconsole -J-Djava.class.path="c:\Program Files\Java\jdk1.5.0_11\lib\jconsole.jar";"c:\Program Files\Java\jdk1.5.0_11\lib\tools.jar";D:\prog\was61\runtimes\com.ibm.ws.admin.client_6.1.0.jar;D:\prog\was61\java\jre\lib\ibmorb.jar

我说也许,因为它对我不起作用。 我收到了一条不错的 jndiUnavailCommErr 错误消息,因为它期望在端口 2809 上有某些内容,而我的 Websphere 安装正在侦听 2810,尽管我在 JMX URL 中正确指定了端口 2810。 但是,如果您调整路径以指向您的 Sun JDK,它可能适合您。 这是我使用 Sun 的 JDK 连接到 Websphere 的最接近的一次。

最后说明:我尝试了基于RMI的解决方案,还有一个可用的SOAP连接器,但还没有尝试过。

与往常一样,J2EE、Websphere 和其他东西:祝你好运,你会需要它的。

Following information is for Websphere 6.1 on Windows.

First of all, the magic URL to connect to the MBean server is:

service:jmx:iiop://<host>:<port>/jndi/JMXConnector

If you have a default Websphere installation, the JNDI port number will likely be 2809, 2810, ... depending on how many servers there are installed on one system and the specific one you want to connect to. To be sure, when starting Websphere, check the logs, as it will dump a line like

0000000a RMIConnectorC A   ADMC0026I: The RMI Connector is available at port 2810

If you don't get this line, open the Websphere admin console and go to

Application servers > server1 >
Administration Services > JMX
connectors

to see if you need to add or change the config.

Second important bit of information is that the following JAR is always needed when doing JMX with the server:

com.ibm.ws.admin.client_6.1.0.jar

You can find this JAR in the the runtimes directory of Websphere. Whatever you do, whether programmatically accessing MBeans on Websphere, or using JConsole, and so on, use the magic URL and always include this JAR.

For the remainder of this answer, assume that Websphere is installed in D:\prog\was61.

To run JConsole, type in the following:

D:\prog\was61\java\bin>jconsole -J-Djava.class.path=d:\prog\was61\java\lib\tools.jar;D:\prog\was61\runtimes\com.ibm.ws.admin.client_6.1.0.jar

Then go to the "Advanced" tab and type in the magic JMX URL. Press connect and you should see the MBeans appear.

Using a Sun JDK is an entirely different matter. You need one extra JAR that is in the lib of the IBM JDK but not Sun's (ibmorb.jar), and maybe the following command may work for you:

C:\Program Files\Java\jdk1.5.0_11\bin>jconsole -J-Djava.class.path="c:\Program Files\Java\jdk1.5.0_11\lib\jconsole.jar";"c:\Program Files\Java\jdk1.5.0_11\lib\tools.jar";D:\prog\was61\runtimes\com.ibm.ws.admin.client_6.1.0.jar;D:\prog\was61\java\jre\lib\ibmorb.jar

I say maybe, because it didn't work for me. I got a nice jndiUnavailCommErr error message, since it expected something on port 2809 while my Websphere installation is listening on 2810, although I correctly specified port 2810 in the JMX URL. But, if you adapt the paths to point to your Sun JDK, it might work for you. It's the closest I ever got to connecting to Websphere using Sun's JDK.

Final note: I tried a solution based on RMI, there is also a SOAP connector available but haven't tried it.

As always with J2EE, Websphere and stuff: good luck, you'll need it.

墨洒年华 2024-07-17 06:40:31

很简单。 只需使用以下 JMX 参数启动 Websphere:

-Djavax.management.builder.initial= 
-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.authenticate=false 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.port=1099

然后启动 JConsole 或 VisualVM 并连接到 localhost:1099

由于不允许我发布证明屏幕截图,所以我发布了 VisualVM“概述选项卡”中的信息。

PID: 12568
Host: localhost
Main class: <unknown>
Arguments: <none>
JVM: IBM J9 VM (2.3, J2RE 1.5.0 IBM J9 2.3 Windows XP x86-32 j9vmwi3223-20100808 (JIT enabled)
J9VM - 20100629_60535_lHdSMr
JIT - 20100623_16197_r8
GC - 20100211_AA)
Java: version 1.5.0, vendor IBM Corporation
Java Home: C:\Program Files\IBM\SDP\runtimes\base_v61\java\jre
JVM Flags: <none>
Heap dump on OOME: disabled

It is simple. Just start Websphere with the following JMX parameters:

-Djavax.management.builder.initial= 
-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.authenticate=false 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.port=1099

Then start JConsole or VisualVM and connect to localhost:1099

Since i am not allowed to post a proof screenshot i post the information from the visualvm "overview tab".

PID: 12568
Host: localhost
Main class: <unknown>
Arguments: <none>
JVM: IBM J9 VM (2.3, J2RE 1.5.0 IBM J9 2.3 Windows XP x86-32 j9vmwi3223-20100808 (JIT enabled)
J9VM - 20100629_60535_lHdSMr
JIT - 20100623_16197_r8
GC - 20100211_AA)
Java: version 1.5.0, vendor IBM Corporation
Java Home: C:\Program Files\IBM\SDP\runtimes\base_v61\java\jre
JVM Flags: <none>
Heap dump on OOME: disabled
因为看清所以看轻 2024-07-17 06:40:31

也许这有点离题,但我找到了一种从 JConsole 连接到 WAS 7.0 JMX 服务器的方法。
不需要服务器设置,不需要 AppClient,只需要一些 JAR 和一些客户端设置。

使用以下脚本

@echo off 
set HOST=<host>
set PORT=2809

set WAS_HOME=D:/Programy/IBM/WebSphere/AppServer

set THIS_DIR=E:/Home/Bogus/Pulpit

set CLIENTSAS=-Dcom.ibm.CORBA.ConfigURL=file:/%THIS_DIR%/sas.client.props
set PROVIDER=-Djava.naming.provider.url=corbaname:iiop:%HOST%:%PORT% 

set PROPS=
set PROPS=%PROPS% %CLIENTSAS%
set PROPS=%PROPS% %PROVIDER%

set CLASSPATH=
set CLASSPATH=%CLASSPATH%;%WAS_HOME%\java\lib\tools.jar
set CLASSPATH=%CLASSPATH%;%WAS_HOME%\runtimes\com.ibm.ws.admin.client_7.0.0.jar
set CLASSPATH=%CLASSPATH%;%WAS_HOME%\runtimes\com.ibm.ws.ejb.thinclient_7.0.0.jar
set CLASSPATH=%CLASSPATH%;%WAS_HOME%\runtimes\com.ibm.ws.orb_7.0.0.jar
set CLASSPATH=%CLASSPATH%;%WAS_HOME%\java\lib\jconsole.jar

set URL=service:jmx:iiop://%HOST%:%PORT%/jndi/JMXConnector

@echo on

:: %WAS_HOME%\java\bin\
java -classpath %CLASSPATH% %PROPS% sun.tools.jconsole.JConsole %URL%

如果目标服务器禁用了管理安全性,请注释掉 CLIENTSAS 和 PROVIDER 行。

如果启用了安全性,您还需要将 sas.client.props 文件放入 THIS_DIR 目录中。 模板文件可以在 WAS_profile\properties 目录下找到。 您将需要进行一些设置。 这是我的 sas.client.props 的摘录

com.ibm.CORBA.securityEnabled=true

com.ibm.CORBA.authenticationTarget=BasicAuth
com.ibm.CORBA.authenticationRetryEnabled=true
com.ibm.CORBA.authenticationRetryCount=3
com.ibm.CORBA.validateBasicAuth=true
com.ibm.CORBA.securityServerHost=
com.ibm.CORBA.securityServerPort=
com.ibm.CORBA.loginTimeout=300
com.ibm.CORBA.loginSource=prompt

com.ibm.CORBA.loginUserid=
com.ibm.CORBA.loginPassword=

com.ibm.CORBA.krb5ConfigFile=
com.ibm.CORBA.krb5CcacheFile=

com.ibm.CSI.performStateful=true

com.ibm.CSI.performClientAuthenticationRequired=false
com.ibm.CSI.performClientAuthenticationSupported=true

# SET ALL THE FOLLOWING VALUES TO FALSE

com.ibm.CSI.performTLClientAuthenticationRequired=false
com.ibm.CSI.performTLClientAuthenticationSupported=false

com.ibm.CSI.performTransportAssocSSLTLSRequired=false
com.ibm.CSI.performTransportAssocSSLTLSSupported=false

com.ibm.CSI.performMessageIntegrityRequired=false
com.ibm.CSI.performMessageIntegritySupported=false

com.ibm.CSI.performMessageConfidentialityRequired=false
com.ibm.CSI.performMessageConfidentialitySupported=false

# COMMENT THIS OUT
#com.ibm.ssl.alias=DefaultSSLSettings


com.ibm.CORBA.requestTimeout=180

OK :)

连接后,将出现登录弹出窗口。 输入您的管理员用户和密码(JConsole 中的连接对话框中不需要用户名和密码)

您可以从 IBM JDK 或 Sun JDK 运行 JConsole。 对于 IBM,不需要其他设置。 但是,对于 Sun,您可能需要将 orb.properties 文件放在您的主目录中。 该文件可以在 com.ibm.ws.ejb.thinclient_7.0.0.jar 中找到。

Maybe it's a little offtopic, but I have found a way to connect to WAS 7.0 JMX server from JConsole.
No server setup is required, no AppClient, only some JARs and a little client setup.

Use the following script

@echo off 
set HOST=<host>
set PORT=2809

set WAS_HOME=D:/Programy/IBM/WebSphere/AppServer

set THIS_DIR=E:/Home/Bogus/Pulpit

set CLIENTSAS=-Dcom.ibm.CORBA.ConfigURL=file:/%THIS_DIR%/sas.client.props
set PROVIDER=-Djava.naming.provider.url=corbaname:iiop:%HOST%:%PORT% 

set PROPS=
set PROPS=%PROPS% %CLIENTSAS%
set PROPS=%PROPS% %PROVIDER%

set CLASSPATH=
set CLASSPATH=%CLASSPATH%;%WAS_HOME%\java\lib\tools.jar
set CLASSPATH=%CLASSPATH%;%WAS_HOME%\runtimes\com.ibm.ws.admin.client_7.0.0.jar
set CLASSPATH=%CLASSPATH%;%WAS_HOME%\runtimes\com.ibm.ws.ejb.thinclient_7.0.0.jar
set CLASSPATH=%CLASSPATH%;%WAS_HOME%\runtimes\com.ibm.ws.orb_7.0.0.jar
set CLASSPATH=%CLASSPATH%;%WAS_HOME%\java\lib\jconsole.jar

set URL=service:jmx:iiop://%HOST%:%PORT%/jndi/JMXConnector

@echo on

:: %WAS_HOME%\java\bin\
java -classpath %CLASSPATH% %PROPS% sun.tools.jconsole.JConsole %URL%

If the target server has administrative security disabled, comment out CLIENTSAS and PROVIDER lines.

If the security is enabled, you will also need sas.client.props file to be put in THIS_DIR directory. The template file can be found under WAS_profile\properties directory. You will have to do a little setup. Here is an excerpt from my sas.client.props

com.ibm.CORBA.securityEnabled=true

com.ibm.CORBA.authenticationTarget=BasicAuth
com.ibm.CORBA.authenticationRetryEnabled=true
com.ibm.CORBA.authenticationRetryCount=3
com.ibm.CORBA.validateBasicAuth=true
com.ibm.CORBA.securityServerHost=
com.ibm.CORBA.securityServerPort=
com.ibm.CORBA.loginTimeout=300
com.ibm.CORBA.loginSource=prompt

com.ibm.CORBA.loginUserid=
com.ibm.CORBA.loginPassword=

com.ibm.CORBA.krb5ConfigFile=
com.ibm.CORBA.krb5CcacheFile=

com.ibm.CSI.performStateful=true

com.ibm.CSI.performClientAuthenticationRequired=false
com.ibm.CSI.performClientAuthenticationSupported=true

# SET ALL THE FOLLOWING VALUES TO FALSE

com.ibm.CSI.performTLClientAuthenticationRequired=false
com.ibm.CSI.performTLClientAuthenticationSupported=false

com.ibm.CSI.performTransportAssocSSLTLSRequired=false
com.ibm.CSI.performTransportAssocSSLTLSSupported=false

com.ibm.CSI.performMessageIntegrityRequired=false
com.ibm.CSI.performMessageIntegritySupported=false

com.ibm.CSI.performMessageConfidentialityRequired=false
com.ibm.CSI.performMessageConfidentialitySupported=false

# COMMENT THIS OUT
#com.ibm.ssl.alias=DefaultSSLSettings


com.ibm.CORBA.requestTimeout=180

OK :)

After connecting, the login popup will appear. Type your admin user and password (user & pw are not required on the connection dialog in JConsole)

You may run the JConsole from IBM JDK, or Sun JDK. For IBM, no other setup is required. However, for Sun you may need to put orb.properties file in your home directory. The file can be found in com.ibm.ws.ejb.thinclient_7.0.0.jar.

你是我的挚爱i 2024-07-17 06:40:31

我无法让它发挥作用。 我得到的只是

与 username@service:jmx:iiop//localhost:2809/jndi/JMXConnector 的连接未成功。 您想再试一次吗?

不过,我确实通过执行以下操作使其正常工作:

  1. 将“-Djavax.management.builder.initial= -Dcom.sun.management.jmxremote”添加到通用 JVM 参数中。
  2. 将这些行添加到 WebSphere/AppServer/java/jre/lib/management/management.properties
com.sun.management.jmxremote.port=9999
com.sun.management.jmxremote.authenticate=false
com.sun.management.jmxremote.ssl=false

但没有显示任何有用的 mbean..?

I couldn't get this to work. All I got was

The connection to username@service:jmx:iiop//localhost:2809/jndi/JMXConnector did not succeed. Would you like to try again?

I did however get it working by doing the following:

  1. Add "-Djavax.management.builder.initial= -Dcom.sun.management.jmxremote" to the Generic JVM Argument.
  2. Add these lines to WebSphere/AppServer/java/jre/lib/management/management.properties
com.sun.management.jmxremote.port=9999
com.sun.management.jmxremote.authenticate=false
com.sun.management.jmxremote.ssl=false

But none of the usefull mbeans show up..?

短叹 2024-07-17 06:40:31

我发现为了使用 Sun JDK JConsole 连接到 WAS 6.1,除了 com.ibm.ws.admin.client_6.1.0.jar JAR 文件之外,我还必须包含以下内容启动 JConsole 时引导类路径上有 3 个 JAR:-

ibmorbapi.jar
ibmorb.jar
ibmcfw.jar

这些可以在 websphere 的 java\jre\lib 目录中找到。

例如,在 Windows 上,如果将上面列出的所有四个 JAR 复制到您选择的目录(在下面的示例中我已将它们复制到 C:\packages\was61-jmx),则可以使用如下所示的批处理文件启动 JConsole:-

set JAVA_HOME=C:\Progra~1\Java\jdk1.5.0_20
set WAS6.1_JARS=C:\packages\was61-jmx

set BOOTJARS=%WAS6.1_JARS%\ibmorbapi.jar
set BOOTJARS=%BOOTJARS%;%WAS6.1_JARS%\ibmorb.jar
set BOOTJARS=%BOOTJARS%;%WAS6.1_JARS%\ibmcfw.jar

set CLASSPATH=%WAS6.1_JARS%\com.ibm.ws.admin.client_6.1.0.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\jconsole.jar


%JAVA_HOME%\bin\jconsole  -J-Xbootclasspath/p:%BOOTJARS% -J-Djava.class.path=%CLASSPATH%

这对我来说适用于 Sun Jconsole 的 jdk 1.5 和 1.6 版本。

I found that in order to connect to WAS 6.1 using the Sun JDK JConsole, in addition to the com.ibm.ws.admin.client_6.1.0.jar JAR file, I had to also include the following 3 JARs on the boot class path when starting JConsole:-

ibmorbapi.jar
ibmorb.jar
ibmcfw.jar

These can be found in the java\jre\lib directory of websphere.

For example on windows, if you copy all the four JARs listed above to a directory of your choice (i've copied them to C:\packages\was61-jmx in the example below), you can use a batch file like the following to start JConsole:-

set JAVA_HOME=C:\Progra~1\Java\jdk1.5.0_20
set WAS6.1_JARS=C:\packages\was61-jmx

set BOOTJARS=%WAS6.1_JARS%\ibmorbapi.jar
set BOOTJARS=%BOOTJARS%;%WAS6.1_JARS%\ibmorb.jar
set BOOTJARS=%BOOTJARS%;%WAS6.1_JARS%\ibmcfw.jar

set CLASSPATH=%WAS6.1_JARS%\com.ibm.ws.admin.client_6.1.0.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\jconsole.jar


%JAVA_HOME%\bin\jconsole  -J-Xbootclasspath/p:%BOOTJARS% -J-Djava.class.path=%CLASSPATH%

This worked for me for jdk 1.5 and 1.6 versions of the Sun Jconsole.

如何视而不见 2024-07-17 06:40:31

我也努力了几个小时才让它发挥作用,并找到了解决方案。 这里的关键问题是 SSL - 客户端必须使用正确的密钥来建立到服务器的 SSL 连接。 这涉及指向正确的信任存储位置和信任存储密码,如 此处。 设置环境的最佳方法是调用相关服务器的 setupCmdLine.sh (在 Windoze 上为 setupCmdLine.bat),然后像这样调用 jconsole:

#!/bin/bash

WAS_HOME=/opt/IBM/WebSphere/AppServer

# setup server-specific env variables
. $WAS_HOME/profiles/AppSrv01/bin/setupCmdLine.sh

HOST=localhost
PORT=9100

CLASSPATH=$JAVA_HOME/lib/jconsole.jar
CLASSPATH=$CLASSPATH:$WAS_HOME/runtimes/com.ibm.ws.admin.client_8.5.0.jar
CLASSPATH=$CLASSPATH:$WAS_HOME/runtimes/com.ibm.ws.ejb.thinclient_8.5.0.jar
CLASSPATH=$CLASSPATH:$WAS_HOME/runtimes/com.ibm.ws.orb_8.5.0.jar

$JAVA_HOME/bin/jconsole \
    -J-Djava.class.path=$CLASSPATH\
    -J$CLIENTSAS\
    -J$CLIENTSSL\
    service:jmx:iiop://$HOST:$PORT/jndi/JMXConnector

I also struggled for a few hours to get this to work and I found the solution. The key issue is here is SSL - the client has to use the proper keys to establish a SSL connection to the server. This involves pointing to the correct trust store location and trust store password as described here. The best way to set up the environment is to call the setupCmdLine.sh (on Windoze it is setupCmdLine.bat) for the relevant server, and then invoke jconsole like this:

#!/bin/bash

WAS_HOME=/opt/IBM/WebSphere/AppServer

# setup server-specific env variables
. $WAS_HOME/profiles/AppSrv01/bin/setupCmdLine.sh

HOST=localhost
PORT=9100

CLASSPATH=$JAVA_HOME/lib/jconsole.jar
CLASSPATH=$CLASSPATH:$WAS_HOME/runtimes/com.ibm.ws.admin.client_8.5.0.jar
CLASSPATH=$CLASSPATH:$WAS_HOME/runtimes/com.ibm.ws.ejb.thinclient_8.5.0.jar
CLASSPATH=$CLASSPATH:$WAS_HOME/runtimes/com.ibm.ws.orb_8.5.0.jar

$JAVA_HOME/bin/jconsole \
    -J-Djava.class.path=$CLASSPATH\
    -J$CLIENTSAS\
    -J$CLIENTSSL\
    service:jmx:iiop://$HOST:$PORT/jndi/JMXConnector
这个俗人 2024-07-17 06:40:31

您无法通过 WAS 控制台设置所需的系统属性,因为它不允许您指定空值。 相反,您必须在“server.xml”底部插入以下内容:

<systemProperties xmi:id="Property_1315391623828" name="com.sun.management.jmxremote" value="" required="false"/>    <systemProperties xmi:id="Property_1315327918140" name="com.sun.management.jmxremote.port" value="1235" required="false"/>
<systemProperties xmi:id="Property_1315327935281" name="com.sun.management.jmxremote.authenticate" value="false" required="false"/>
<systemProperties xmi:id="Property_1315327948046" name="com.sun.management.jmxremote.ssl" value="false" required="false"/>
<systemProperties xmi:id="Property_1315390852859" name="javax.management.builder.initial" value="" required="false"/>

You cannot set the required system properties through the WAS console, because it does not allow you specify empty values. Instead, you have to insert the following at the bottom of 'server.xml':

<systemProperties xmi:id="Property_1315391623828" name="com.sun.management.jmxremote" value="" required="false"/>    <systemProperties xmi:id="Property_1315327918140" name="com.sun.management.jmxremote.port" value="1235" required="false"/>
<systemProperties xmi:id="Property_1315327935281" name="com.sun.management.jmxremote.authenticate" value="false" required="false"/>
<systemProperties xmi:id="Property_1315327948046" name="com.sun.management.jmxremote.ssl" value="false" required="false"/>
<systemProperties xmi:id="Property_1315390852859" name="javax.management.builder.initial" value="" required="false"/>
那请放手 2024-07-17 06:40:31

来自 http://malliktalksjava.in/2010/07 /26/enable-jmx-remote-port-in-websphere/

  1. 登录到Web Sphere任何配置文件(服务器)的管理控制台,快捷方式将在启动时可用菜单程序。

    • 部署 PerfServletApp.ear 应用程序(如果尚未部署)。
    • 检查PerfServletApp.ear是否已部署:
      • 扩展应用程序 +> 应用程序类型 +> WebSphere 企业应用程序
      • 如果没有,请点击新应用程序
    • WebSphere 目录浏览 -> 应用服务器 -> 可安装的应用程序
    • (按照步骤操作。)
  2. 启用 PMI 数据并启用所有统计数据。

    • 在左窗格(底部)中,转到监控和调整 +> 性能监控基础设施(PMI)
    • 配置选项卡中,启用PMI
    • 在此配置选项卡和运行时选项卡中,设置所有统计信息。 然后保存更改。
  3. 设置 JVM 参数

    • 服务器中+> 服务器类型 +> WebSphere 应用程序服务器,然后 -> [服务器名称] +> 流程定义 -> Java虚拟机
    • 设置要包含的通用 jvm 参数

      <块引用>

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

    显示服务器列表。 单击您想要的服务器。

    • 在右窗格中 -> 服务器基础设施 -> Java 和进程管理再次在配置选项卡的“其他属性”中单击进程定义
      单击Java 虚拟机。 将 -Djavax.management.builder.initial= -Dcom.sun.management.jmxremote 放入 Generic Jvm Argument 字段中
      保存更改。
  4. 要启用 JMX 远程端口,请打开以下属性文件并添加以下代码。
    [WebSphere-directory]\AppServer\java\jre\lib\management\management.properties中,添加:

    com.sun.management.jmxremote.port=9001 
      com.sun.management.jmxremote.ssl=false 
      com.sun.management.jmxremote.authenticate=false 
      
  5. 保存主数据,停止服务器,然后启动服务器以加载更改.

from http://malliktalksjava.in/2010/07/26/enable-jmx-remote-port-in-websphere/

  1. Login to Admin console of the web sphere any profile(server), short cut will be available in start menu programs.

    • Deploy the PerfServletApp.ear application if not deployed already.
    • Check if PerfServletApp.ear is deployed:
      • Exapnd Applications +> Application Types +> WebSphere Enterpise Applications
      • If not, click New Application.
    • Browse from WebSphere directory -> AppServer -> InstallableApps.
    • (FOLLOW THE STEPS.)
  2. Enable the PMI Data and set all the statistics enabled.

    • In left pane (bottom), go to Monitoring and Tuning +> Performance Monitoring Infrastructure(PMI)
    • In Configuration tab, enable the PMI.
    • In this Configuration tab, and the Runtime tab, set All statistics. Then Save changes.
  3. Set JVM argument

    • In Severs +> Server Types +> WebSphere Application Servers, then -> [server-name] +> Process definition -> Java Virtual Machine
    • Set the generic jvm argument to include

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

    in shows the servers list. click on the server you want.

    • In the right pane -> Server Infrastructure -> Java and Process Management click on Process definition, again in Additional Properties of Configuration tab
      click on Java Virtual Machine. put the -Djavax.management.builder.initial= -Dcom.sun.management.jmxremote in Generic Jvm Argument field
      and save changes.
  4. To enable the JMX remote port open the following properties file and add the code that follows.
    In [WebSphere-directory]\AppServer\java\jre\lib\management\management.properties, add:

    com.sun.management.jmxremote.port=9001
    com.sun.management.jmxremote.ssl=false
    com.sun.management.jmxremote.authenticate=false
    
  5. Save the master data, stop the server, and start the server to load the changes.

一枫情书 2024-07-17 06:40:31

看下面将 jconsole 连接到 Websphere 6.1 的简​​单方法

它确实适合我(Solaris、Was 6.1、Sun JVM),它也适用于 Visual VM

Enjoy!

Look at the following simple method to connect jconsole to Websphere 6.1

It does works for me (Solaris, Was 6.1, Sun JVM), it also works with Visual VM

Enjoy !

鸠书 2024-07-17 06:40:31

您可以在 WebSphere Application Server 上的“通讯”->“通讯”下找到要连接的正确端口。 港口。 与 BOOTSTRAP_ADDRESS 关联的端口允许您进行连接。

You can find the correct port to connect to on the WebSphere Application Server under Communications -> Ports. The port associated with BOOTSTRAP_ADDRESS allows you to connect.

心安伴我暖 2024-07-17 06:40:31

您可以尝试以下方法,它使用 SOAP 协议适配器。 我认为这是尽可能精简的配置。

#!/bin/sh 
current_dir=`dirname "$0"`

HOSTNAME=host.fqdn
PORT=2809

WAS_HOME=/opt/IBM/WebSphere/AppServer
WAS_PROFILE=$WAS_HOME/profiles/AppSrv01
WAS_RUNTIMES=$WAS_HOME/runtimes

WAS_LIB=$WAS_HOME/java/lib
JAVA_HOME=$WAS_HOME/java



CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/jconsole.jar:$WAS_RUNTIMES/com.ibm.ws.admin.client_7.0.0.jar:$WAS_LIB/ibmcfw.jar 

TARGET=service:jmx:soap://$HOSTNAME:$PORT/jndi/JMXConnector

CP="-J-Djava.class.path=$CLASSPATH"
SSL_SERVER_KEY="-J-Djavax.net.ssl.keyStore=$WAS_PROFILE/etc/DummyServerKeyFile.jks -J-Djavax.net.ssl.keyStorePassword=WebAS"
SSL_TRUST_STORE="-J-Djavax.net.ssl.trustStore=$WAS_PROFILE/etc/DummyServerTrustFile.jks -J-Djavax.net.ssl.trustStorePassword=WebAS"
SSL_OPTS="-J-Dcom.ibm.SSL.ConfigURL=file:$WAS_PROFILE/properties/ssl.client.props"
SOAP_OPTS="-J-Dcom.ibm.SOAP.ConfigURL=file:$WAS_PROFILE/properties/soap.client.props"
WAS_OPTS="-J-Dwas.install.root=$WAS_HOME -J-Djava.ext.dirs=$WAS_HOME/plugins:$WAS_HOME/lib:$WAS_HOME/plugins/com.ibm.ws.security.crypto_6.1.0:$WAS_HOME/lib:$JAVA_HOME/jre/lib/ext"

COMMAND="$JAVA_HOME/bin/jconsole $CP $SSL_SERVER_KEY $SSL_TRUST_STORE $SSL_OPTS $SOAP_OPTS $WAS_OPTS $TARGET"

exec $COMMAND

感谢我的同事 Jeroen 使用 IIOP 编写的脚本的初始版本(我正在尝试 SOAP,希望它能够与 Hyperic 一起使用)

you can try the following, it uses the SOAP protocol adapter. I think it's as lean a configuration possible.

#!/bin/sh 
current_dir=`dirname "$0"`

HOSTNAME=host.fqdn
PORT=2809

WAS_HOME=/opt/IBM/WebSphere/AppServer
WAS_PROFILE=$WAS_HOME/profiles/AppSrv01
WAS_RUNTIMES=$WAS_HOME/runtimes

WAS_LIB=$WAS_HOME/java/lib
JAVA_HOME=$WAS_HOME/java



CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/jconsole.jar:$WAS_RUNTIMES/com.ibm.ws.admin.client_7.0.0.jar:$WAS_LIB/ibmcfw.jar 

TARGET=service:jmx:soap://$HOSTNAME:$PORT/jndi/JMXConnector

CP="-J-Djava.class.path=$CLASSPATH"
SSL_SERVER_KEY="-J-Djavax.net.ssl.keyStore=$WAS_PROFILE/etc/DummyServerKeyFile.jks -J-Djavax.net.ssl.keyStorePassword=WebAS"
SSL_TRUST_STORE="-J-Djavax.net.ssl.trustStore=$WAS_PROFILE/etc/DummyServerTrustFile.jks -J-Djavax.net.ssl.trustStorePassword=WebAS"
SSL_OPTS="-J-Dcom.ibm.SSL.ConfigURL=file:$WAS_PROFILE/properties/ssl.client.props"
SOAP_OPTS="-J-Dcom.ibm.SOAP.ConfigURL=file:$WAS_PROFILE/properties/soap.client.props"
WAS_OPTS="-J-Dwas.install.root=$WAS_HOME -J-Djava.ext.dirs=$WAS_HOME/plugins:$WAS_HOME/lib:$WAS_HOME/plugins/com.ibm.ws.security.crypto_6.1.0:$WAS_HOME/lib:$JAVA_HOME/jre/lib/ext"

COMMAND="$JAVA_HOME/bin/jconsole $CP $SSL_SERVER_KEY $SSL_TRUST_STORE $SSL_OPTS $SOAP_OPTS $WAS_OPTS $TARGET"

exec $COMMAND

Credits to my colleague Jeroen for the initial version of the script using IIOP (I'm trying SOAP in the hope that it will work with Hyperic)

初熏 2024-07-17 06:40:31

好的。 有两种方法可以做到这一点:
一种使用 SOAP 连接器
一种使用 RMi/IIOP 连接器。

对于 SOAP,您需要进行 WAS 设置以添加新的 PORT 和上述其他 JVM 参数。 但是,一旦 JConsole 连接到服务器,您得到的只是基本的 JVM 指标。

通过 RMI,您可以获得 WebSphere 公开的一切。 所有 MBean!
唯一需要注意的是:如果您的 WAS JVM 位于防火墙后面 - 您需要打开一个端口才能从桌面访问它。 但您可以通过 X11 直接在应用程序服务器主机上运行它!

我在 Windows XP 桌面上使用 JDK7 连接到启用了全局安全性的 WAS 7.0。
我从上面的答案 #4 中获取了一个脚本并将其用作起点。
这是我的版本:

@echo off 
set HOST=<put hostname here>
set PORT=<put JVM's BOOTSTRAP_PORT here>

set WAS_HOME=C:\jconsole
set JAVA_HOME=C:\glassfish3\jdk7
set PROPS_DIR=C:\jconsole\properties

set CLIENTSAS=-Dcom.ibm.CORBA.ConfigURL=file:/%PROPS_DIR%/sas.client.props
set CLIENTSSL=-Dcom.ibm.SSL.ConfigURL=file:/%PROPS_DIR%/ssl.client.props
set PROVIDER=-Djava.naming.provider.url=corbaname:iiop:%HOST%:%PORT% 

set PROPS=
set PROPS=%PROPS% %CLIENTSAS% %CLIENTSSL% %PROVIDER%

set CLASSPATH=
set CLASSPATH=%CLASSPATH%;%WAS_HOME%\com.ibm.ws.admin.client_7.0.0.jar
set CLASSPATH=%CLASSPATH%;%WAS_HOME%\com.ibm.ws.ejb.thinclient_7.0.0.jar
set CLASSPATH=%CLASSPATH%;%WAS_HOME%\com.ibm.ws.orb_7.0.0.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\jconsole.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar

set URL=service:jmx:iiop://%HOST%:%PORT%/jndi/JMXConnector

@echo on

%JAVA_HOME%\bin\java -classpath %CLASSPATH% %PROPS% sun.tools.jconsole.JConsole %URL%

WAS_HOME 只是一个目录,其中包含我从 WebSphere 二进制文件(Solaris 之外)下载的 IBM JAR。 我还在其中创建了两个子目录:propertieskeystore
在属性子目录中,我放置了 sas.client.props 和 ssl.client.props,它们也是从工作的 WAS7 单元下载的(我将其从 DM 上取下)。
在密钥库子目录中,我放置了 key.p12 和 trust.p12 文件,这些文件也是从 WAS7 单元下载的。 确保他们拥有正确的证书! 如果 WAS/etc 中的那些不起作用 - 尝试 ${CONFIG_ROOT}/cells/ 中的那些。
修改 ssl.client.props 以确保 p12 文件的路径正确!

现在,为了使其正常工作,您还必须从 WAS 二进制文件下载以下内容:

WAS_BIN_HOME/java/jre/lib/endorsed

将整个目录放在您的 SUN JDK 的 jre/lib 目录。 这可以解决 IBM JSSE2 Provider 错误等问题。
另外,从 WAS_BIN_HOME/java/jre/lib/security 获取以下三个文件:

java.security
local_policy.jar
US_export_policy.jar

我刚刚用从 IBM 获取的文件覆盖了 SUN JDK 附带的文件。

另外,在 sas.client.props 中,请务必输入用户 ID 和密码,类似于在soap.client.props 中的操作方式。 您可以用同样的方式对密码进行编码。 这是通过 Global Security 的 BasicAuth 所必需的。

我想就是这样。
PS 我不是 Windows 专业人士,所以如果有更干净的方法来做到这一点 - 请分享。

Ok. There are two ways to do this:
one using SOAP connector
one using RMi/IIOP connector.

For SOAP you need to do WAS setup to add a new PORT and other JVM args described above. But all you get once JConsole connects to the server are basic JVM metrics.

With RMI you get everything that WebSphere exposes. All the MBeans!
The only caveat is: if your WAS JVM is behind a firewall - you'd need to open a port to get to it from your desktop. But you can run this via X11 right off the app server host!

I used JDK7 on my Windows XP desktop to connect to WAS 7.0 with global security enabled.
I took a script from Answer #4 above and used it as a starting point.
Here's my version of it:

@echo off 
set HOST=<put hostname here>
set PORT=<put JVM's BOOTSTRAP_PORT here>

set WAS_HOME=C:\jconsole
set JAVA_HOME=C:\glassfish3\jdk7
set PROPS_DIR=C:\jconsole\properties

set CLIENTSAS=-Dcom.ibm.CORBA.ConfigURL=file:/%PROPS_DIR%/sas.client.props
set CLIENTSSL=-Dcom.ibm.SSL.ConfigURL=file:/%PROPS_DIR%/ssl.client.props
set PROVIDER=-Djava.naming.provider.url=corbaname:iiop:%HOST%:%PORT% 

set PROPS=
set PROPS=%PROPS% %CLIENTSAS% %CLIENTSSL% %PROVIDER%

set CLASSPATH=
set CLASSPATH=%CLASSPATH%;%WAS_HOME%\com.ibm.ws.admin.client_7.0.0.jar
set CLASSPATH=%CLASSPATH%;%WAS_HOME%\com.ibm.ws.ejb.thinclient_7.0.0.jar
set CLASSPATH=%CLASSPATH%;%WAS_HOME%\com.ibm.ws.orb_7.0.0.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\jconsole.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar

set URL=service:jmx:iiop://%HOST%:%PORT%/jndi/JMXConnector

@echo on

%JAVA_HOME%\bin\java -classpath %CLASSPATH% %PROPS% sun.tools.jconsole.JConsole %URL%

The WAS_HOME is just a directory where i have those IBM JARs that i downloaded from my WebSphere binaries (off Solaris). I also created two subdirs under there: properties and keystore.
In the properties subdir i put my sas.client.props and ssl.client.props, also downloaded from a working WAS7 cell (i took it off of a DM).
In the keystore subdir i put the key.p12 and trust.p12 files, also downloaded from a WAS7 cell. Make sure they have the right certs! If the ones from WAS/etc don't work - try the ones from ${CONFIG_ROOT}/cells/.
Modify ssl.client.props to make sure the path to the p12 files is correct!

Now, in order for this to work you also have to download the following from your WAS binaries:

WAS_BIN_HOME/java/jre/lib/endorsed

Put this whole directory under your SUN JDK's jre/lib directory. This takes care of the IBM JSSE2 Provider errors and such.
Also, get the following three files from WAS_BIN_HOME/java/jre/lib/security:

java.security
local_policy.jar
US_export_policy.jar

I just overwrote the ones that came with SUN's JDK with the ones i took from IBM's.

Also, in sas.client.props be sure to enter user ID and password, similar to how you do it in soap.client.props. You can encode the password the same way. This is needed to get past Global Security's BasicAuth.

I think that's it.
P.S. I'm not a Windows pro, so if there's a cleaner way to do this - please share it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文