- Blog Xebia France - -

Posted By Benoit Moussaud One on Thursday, June 28th, 2007 14:57 IN J2EE 9 Comments

JCONSOLE is an available tool from JDK 5.0 who is based on the IPA - INTERNATIONAL PHONETIC ALPHABET JMX to show and to follow the metric of a virtual machine Popular dance.
The different categories are:

  • The state of memory and of garbages collections.
  • Threads, list activity and, as on Thread Dump.
  • Load of classes.
  • Coherent and the management of MBEANS.
  • General information on JVM (ClassPath, Library Path, Argument of JVM).

There are two ways of linking JCONSOLE on a virtual machine Popular dance 5:

In place

Local mode requires that JCONSOLE and virtual machine are on the same machine. It is then enough to add property to the starting of the virtual machine: -Dcom.sun.management.jmxremote.
Note: From JDK 6, this property is positioned by default, therefore all JVM will be able to be monitor es ' Out Of the Lock-up garage '.

The practicable of JCONSOLE is located in <JAVA_HOME> / bin. In starting, JCONSOLE shows all the accessible JVM.

With hindsight

JMX defines the protocol MINIMUM BENEFIT as protocol of exchange. By default, they consider that there is two realisation of MINIMUM BENEFIT:

  • JRMP (Popular dance Remote Method Protocol)
  • IIOP (Internet Inter-Orb Protocol)

The server of applications BEA Weblogic offers an additional realisation (and more competitive), .

The continuation of this ticket itemises shape to be set up for each of three protocols, and advantages and disadvantages of each.

JRMP

To achieve in JVM by JRMP, it is necessary to add following properties:

-Dcom.sun.management.jmxremote-Dcom.sun.management.jmxremote.port=12345
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false

Note: Parametres com.sun.management.jmxremote.ssl=false and com.sun.management.jmxremote.authenticate=false introduce a broad fault of security on JVM (neither authentication, nor encryption of exchanged data). The installation of an authentication is possible by defining users' list in the file <Java_Home>. Everything is d tail on ' Luis-Miguel Alventosa' s Blog ': . The encryption by SSL is possible but very heavy to set up (generation of certificates)

With JCONSOLE, there are then two means to be connected:

  • Or by the thumb-index ' Remote ' by specifying the name or the IP address of the machine and the harbour specified by com.sun.management.jmxremote.port property.
  • Or by the thumb-index ' Advanced ' by specifying following URL: service:jmx:rmi:///jndi / rmi://192.168.199.131:7001:12345 / jmxrmi. The building of URL is partly explained in the javadoc of the class JMXSERVICEURL. Fields User Name and Password remain empty.

Advantages: Simplicity of implementation and of connection (Thumb-index ' Remote ').
Disadvantage: Security.

IIOP

Popular dance MINIMUM BENEFIT OVER IIOP allows of if interfacer with ORB, specified by CORBA (Common Object Request Broker Architecture). The servers of applications certified J2EE has to to support the protocol IIOP (MINIMUM BENEFIT / IIOP). To link JCONSOLE on a server of applications WebLogic 9.x with the protocol IIOP, it is necessary to speed this protocol up and to declare an user to authenticate. Procedure is described . JVM requires to be started with option:

-Dcom.sun.management.jmxremote

In JCONSOLE, he is the following URL needs to use the thumb-index ' Advanced ' and to point out:
service:jmx:rmi:///jndi/iiop://192.168.199.131:7001/weblogic.management.mbeanservers.runtime

Advantage: -
Disadvantages: Complicated to define, complexity linked to the protocol IIOP.

T3

J2EE 1.0 did not impose the support of IIOP. A more competitive possessing protocol GAPED then perfected T3. Since, the protocol T3 is the protocol by default to achieve the different distant objects accommodated on a server of applications WebLogic. Since T3 implements MINIMUM BENEFIT, it is possible to connect JCONSOLE to JVM with T3.

First of all it is needed:

  • Add the jar Weblogic to the launching of JCONSOLE.
  • To point out ' ClientProviders ' given by GAPED (property jmx.remote.protocol.provider.pkgs).
jeu JAVA_HOME=D:\BEA\ALSB21\JDK150_04
%JAVA_HOME %\bin\jconsole.exe 
-J-Djmx.remote.protocol.provider.pkgs=weblogic.management.remote-J-Djava.class.path = % JAVA_HOME %\lib\jconsole.jar; D:\bea\alsb21\weblogic91\server\lib\weblogic.jar; %JAVA_HOME %\lib\tools.jar </pre>;%JAVA_HOME%\lib\tools.jar</pre>

To be connected, it is necessary to use mode ' advanced ' and to point out:

  • JMXURL: service:jmx:t3://192.168.199.131:7001/jndi/weblogic.management.mbeanservers.runtime
  • UserName: Weblogic
  • Password: ********

The user has to have the rights of administration.

JMX CONNECTION FAILED

After activation of logs and analysis I pointed out that credentials (UserName and Password) was not transferred at the time of the lookup of the object MBEANSERVER. To remedy it, it is enough to write a new ' ClientProvider ' of the protocol T3 who is going to perform this manipulation: transfer of property ' jmx.remote.credentials ' towards ' Java.naming.security.principal ' and ' Java.naming.security.credentials '.

It is then necessary to adjust the line of order (addition of the class fr.xebia.jmx.remote.t3. ClientProvider in the ClassPath and modification of property jmx.remote.protocol.provider.pkgs).

jeu JAVA_HOME=D:\BEA\ALSB21\JDK150_04
%JAVA_HOME %\bin\jconsole.exe        
 -J-Djmx.remote.protocol.provider.pkgs=fr.xebia.jmx 
 -J-Djava.class.path=t3jconsole.jar, %JAVA_HOME %\lib\jconsole.jar; D:\bea\alsb21\weblogic91\server\lib\weblogic.jar; %JAVA_HOME %\lib\tools.jar

With the same information taken in into the thumb-index ' Advanced ', you will be linked now to your server of applications WebLogic 9 with JCONSOLE by using the protocol T3.

Advantage: No additional definition of parametres (activation of the protocol IIOP and statement to employ IIOP require an upturn of the server).
Disadvantage: It is impossible to connect JCONSOLE before the server is ' Running ', therefore no monitoring of the starting of the server.

Conclusion

JCONSOLE allows fast to see behaviour memo, CPU and treatments of a server of applications. From now on, think of adding '-Dcom.sun.management.jmxremote' on all JVM 5.0 to allow a quick diagnosis in case of problem.

References

  • JMX and JCONSOLE in the laboratory Sun de Sup Info.
  • Using JCONSOLE on the site of Sun.
  • File T3CONSOLE (.java and.class)

Article printed from Blog Xebia France:

URL to article: / 2007 / 06 / 28 / jconsole-et-weblogic-9 /

Click to print.