Published on WSO2 Oxygen Tank (http://wso2.org)

Managing WSO2 WSAS using MC4J

By afkham_azeez
Created 2008-01-25 03:07

Java Management Extensions(JMX) is a technology that allows you to implement management interfaces for Java applications. In this tutorial, Afkham Azeez describes how to manage WSAS via JMX using the MC4J console.

 

Enabling JMX in WSAS [0]
  • What is MC4J [0]
  • The WSAS MBeans [0]
    • ServerAdmin MBean [0]
    • ServiceAdminMBean [0]
    • Statistics MBean [0]
  • service:jmx:rmi:///jndi/rmi://10.100.1.74:9999/server [1]

    http://mc4j.org/confluence/display/MC4J/Download [2]. Downloads for various platforms including Windows, Linux & Mac OS are also available here.

     

    Installing MC4J

    Once you have dowloaded and saved MC4J to your local disk, run the installer. The file you will have to execute will depend on your installation platform.  Figure 1 shows the first screen in the MC4J installation wizard. Simply click 'Next' in this screen.

    Installation Step1

    Figure 1: MC4J Installation - Step 1 

     

    Next, you will have to specify the JRE to be used by MC4J. Note that MC4J requires JRE 1.4 or newer versions, while JRE 1.5 is recommended. The MC4J installation wizard will try to figure out the JVMs installed on your machine and suggest one. If the wizard cannot find a JVM, check that your system contains a JVM. You could specify a JVM using the "Choose Another..." button. See figure 2.

     Figure 2: MC4J Installation - Step 2

     

    In the next step, you wil have to specify the MC4J installation home directory. Make sure that you have write access to this directory. If the directory does not exist, the installation wizard will create one for you. See figure 3.

    Figure 3: MC4J Installation - Step 3

     

    In the next step of the installation, you will be prompted to create links to MC4J. For convenience sake, you may opt to create a link to the MC4J consol application on your Desktop. You can also refrain from creating any links by selecting the "Don't create links" option. See figure 4.

    Figure 4: MC4J Installation - Step 4

     

    Figure 5 shows the installation progress. 

    Figure 5: MC4J Installation - Step 5
     

    Finally, if the MC4J installation was successful, you will see the following screen titled "Install Complete". See figure 6.


     Figure 6: MC4J Installation - Step 6

     

    Connecting to WSAS from MC4J

    Once you have successfully installed MC4j, you could start up the MC4J console either from the command line or from the link you created during installation. The MC4J console startup script will be avaialable in the MC4J home directory.

    On the welcome screen (figure 7), notice the MC4J Connections tab at the top left hand side corner. Right click on the "MC4J Connections" icon and select "Connect to server...".  Now the connection creation wizard will appear. The next step is to define how to connect to the WSAS JMX service.

     

    Figure 7: MC4J Console - Welcome Screen

     

    Figure 8 shows the new connection wizard. In step 1 titled 'Connect to Server', we need to provide all parameters necessary for connecting to the WSAS server. From the drop down list at the top, select J2SE 5.0 (assuming that you started WSAS on J2SE 5.0). Give the connection names as "wsas" or any other of your choice. For the "Initial Context Factory" entry, select "com.sun.jndi.rmi.registry.RegistryContextFactory". For the "Server URL" entry, you will need to provide the JMX service URL of the WSAS JMX service. This is the same URL that was printed out on the WSAS console or log file as explained in the "Enabling JMX in WSAS" section above. For the "Principle" entry, you need to provide the username if an administrative user and for the "Credentials" entry, you need to provide the password of that user. You can type in the default username and password combination admin/admin to login, provided you haven't changed the password of the admin user.  If you have changed the admin password, you will need to provide that password. Note that this is the same administrator account that is used for looging in to the WSAS Management Console. Any user having the admin role can connect to the JMX service. Click "Next". In the next step, simply click "Finish".

    Figure 8: MC4J Console - Create New Connection Step 1

     

    If MC4J was able to successfully connect to WSAS, you should be able to see a new connection named "wsas". Note that the connection name wil be the one you provided during connection creation step. Double clicking on the "wsas" connection will expand that node in the tree and you should be able to view serveral JMX domains including org.wso2.wsas & Catalina. Under the org.wso2.wsas domain, you should be able to see 3 MBeans; ServerAdmin, ServiceAdmin & Statistics.

    [1] [2] talks about how console can be used for monitoring WSAS.

    References

    1. http://wso2.org/project/wsas/java/2.2/docs/jmx.html [3]
    2. MC4J Home Page - http://mc4j.org/confluence/display/mc4j/Home [4]
    3. MC4J User guide - http://mc4j.org/confluence/display/MC4J/User+Guide [5]

     

    More Information

    Rest of the WSO2 WSAS HOWTO series [6]

    Author

    Afkham Azeez, Architect and Product Manager WSO2 WSAS, azeez@wso2.com


    Source URL:
    http://wso2.org/library/3121