[ACCEPTED]-How do you enable JMX in Websphere?-jconsole
Following information is for Websphere 6.1 43 on Windows.
First of all, the magic URL to 42 connect to the MBean server is:
service:jmx:iiop://<host>:<port>/jndi/JMXConnector
If you have 41 a default Websphere installation, the JNDI 40 port number will likely be 2809, 2810, ... depending 39 on how many servers there are installed 38 on one system and the specific one you want 37 to connect to. To be sure, when starting 36 Websphere, check the logs, as it will dump 35 a line like
0000000a RMIConnectorC A ADMC0026I: The RMI Connector is available at port 2810
If you don't get this line, open 34 the Websphere admin console and go to
Application 33 servers > server1 > Administration Services 32 > JMX connectors
to see if you need to 31 add or change the config.
Second important 30 bit of information is that the following 29 JAR is always needed when doing JMX with 28 the server:
com.ibm.ws.admin.client_6.1.0.jar
You can find this JAR in the 27 the runtimes
directory of Websphere. Whatever you 26 do, whether programmatically accessing MBeans 25 on Websphere, or using JConsole, and so 24 on, use the magic URL and always include this 23 JAR.
For the remainder of this answer, assume 22 that Websphere is installed in D:\prog\was61.
To 21 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 20 go to the "Advanced" tab and type in the 19 magic JMX URL. Press connect and you should 18 see the MBeans appear.
Using a Sun JDK is 17 an entirely different matter. You need one 16 extra JAR that is in the lib of the IBM 15 JDK but not Sun's (ibmorb.jar), and maybe 14 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 13 say maybe, because it didn't work for me. I 12 got a nice jndiUnavailCommErr error message, since 11 it expected something on port 2809 while 10 my Websphere installation is listening on 9 2810, although I correctly specified port 8 2810 in the JMX URL. But, if you adapt the 7 paths to point to your Sun JDK, it might 6 work for you. It's the closest I ever got 5 to connecting to Websphere using Sun's JDK.
Final 4 note: I tried a solution based on RMI, there 3 is also a SOAP connector available but haven't 2 tried it.
As always with J2EE, Websphere 1 and stuff: good luck, you'll need it.
It is simple. Just start Websphere with 5 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 4 JConsole or VisualVM and connect to localhost:1099
Since 3 i am not allowed to post a proof screenshot 2 i post the information from the visualvm 1 "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
Maybe it's a little offtopic, but I have 20 found a way to connect to WAS 7.0 JMX server 19 from JConsole. No server setup is required, no 18 AppClient, only some JARs and a little client 17 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 16 server has administrative security disabled, comment 15 out CLIENTSAS and PROVIDER lines.
If the 14 security is enabled, you will also need 13 sas.client.props file to be put in THIS_DIR 12 directory. The template file can be found 11 under WAS_profile\properties directory. You 10 will have to do a little setup. Here is 9 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 8 connecting, the login popup will appear. Type 7 your admin user and password (user & pw 6 are not required on the connection dialog 5 in JConsole)
You may run the JConsole from 4 IBM JDK, or Sun JDK. For IBM, no other setup 3 is required. However, for Sun you may need 2 to put orb.properties file in your home 1 directory. The file can be found in com.ibm.ws.ejb.thinclient_7.0.0.jar.
I couldn't get this to work. All I got was 5
The connection to username@service:jmx:iiop//localhost:2809/jndi/JMXConnector 4 did not succeed. Would you like to try again?
I 3 did however get it working by doing the 2 following:
- Add "-Djavax.management.builder.initial= -Dcom.sun.management.jmxremote" to the Generic JVM Argument.
- 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 1 show up..?
I found that in order to connect to WAS 12 6.1 using the Sun JDK JConsole, in addition 11 to the com.ibm.ws.admin.client_6.1.0.jar
JAR file, I had to also include 10 the following 3 JARs on the boot class path 9 when starting JConsole:-
ibmorbapi.jar
ibmorb.jar
ibmcfw.jar
These can be found 8 in the java\jre\lib directory of websphere.
For 7 example on windows, if you copy all the 6 four JARs listed above to a directory of 5 your choice (i've copied them to C:\packages\was61-jmx 4 in the example below), you can use a batch 3 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 2 worked for me for jdk 1.5 and 1.6 versions 1 of the Sun Jconsole.
I also struggled for a few hours to get 10 this to work and I found the solution. The 9 key issue is here is SSL - the client has 8 to use the proper keys to establish a SSL 7 connection to the server. This involves 6 pointing to the correct trust store location 5 and trust store password as described here. The 4 best way to set up the environment is to 3 call the setupCmdLine.sh (on Windoze it 2 is setupCmdLine.bat) for the relevant server, and 1 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
You cannot set the required system properties 4 through the WAS console, because it does 3 not allow you specify empty values. Instead, you 2 have to insert the following at the bottom 1 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"/>
from http://malliktalksjava.in/2010/07/26/enable-jmx-remote-port-in-websphere/
Login to Admin console of the web sphere any profile(server), short 8 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.)
Enable 7 the PMI Data and set all the statistics 6 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.
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 5 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.
To enable 4 the JMX remote port open the following properties 3 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
Save 2 the master data, stop the server, and start 1 the server to load the changes.
Look at the following simple method to connect jconsole to Websphere 6.1
It does works for 2 me (Solaris, Was 6.1, Sun JVM), it also 1 works with Visual VM
Enjoy !
You can find the correct port to connect 3 to on the WebSphere Application Server under 2 Communications -> Ports. The port associated 1 with BOOTSTRAP_ADDRESS allows you to connect.
you can try the following, it uses the SOAP 5 protocol adapter. I think it's as lean a 4 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 3 Jeroen for the initial version of the script 2 using IIOP (I'm trying SOAP in the hope 1 that it will work with Hyperic)
Ok. There are two ways to do this: one using 41 SOAP connector one using RMi/IIOP connector.
For 40 SOAP you need to do WAS setup to add a new 39 PORT and other JVM args described above. But 38 all you get once JConsole connects to the 37 server are basic JVM metrics.
With RMI you 36 get everything that WebSphere exposes. All 35 the MBeans! The only caveat is: if your 34 WAS JVM is behind a firewall - you'd need 33 to open a port to get to it from your desktop. But 32 you can run this via X11 right off the app 31 server host!
I used JDK7 on my Windows XP 30 desktop to connect to WAS 7.0 with global 29 security enabled. I took a script from Answer 28 #4 above and used it as a starting point. Here's 27 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 26 directory where i have those IBM JARs that 25 i downloaded from my WebSphere binaries 24 (off Solaris). I also created two subdirs 23 under there: properties and keystore. In the properties subdir 22 i put my sas.client.props and ssl.client.props, also 21 downloaded from a working WAS7 cell (i took 20 it off of a DM). In the keystore subdir 19 i put the key.p12 and trust.p12 files, also 18 downloaded from a WAS7 cell. Make sure they 17 have the right certs! If the ones from WAS/etc 16 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 15 order for this to work you also have to 14 download the following from your WAS binaries:
WAS_BIN_HOME/java/jre/lib/endorsed
Put 13 this whole directory under your SUN JDK's 12 jre/lib directory. This takes care of the IBM JSSE2 11 Provider errors and such. Also, get the 10 following three files from WAS_BIN_HOME/java/jre/lib/security:
java.security
local_policy.jar
US_export_policy.jar
I just overwrote 9 the ones that came with SUN's JDK with the 8 ones i took from IBM's.
Also, in sas.client.props be sure 7 to enter user ID and password, similar to 6 how you do it in soap.client.props. You 5 can encode the password the same way. This 4 is needed to get past Global Security's 3 BasicAuth.
I think that's it. P.S. I'm not 2 a Windows pro, so if there's a cleaner way 1 to do this - please share it.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.