Version 3

    Using JBoss Cache MBean with Bea Weblogic


    Here is an example of how to integrate the JBoss Cache MBean into the BEA WebLogic MBeanServer.

    You can add this to code to the example startup Class in JBossCacheAndWebLogic so that the JBoss Cache instance is registered in the MBean server upon startup.



    // Create the TreeCache Object.
    TreeCache _cache = new TreeCache();
    // ... initialise the TreeCache with your configuration
    // Get the InitialContext.
    Context ctx = new InitialContext();
    MBeanServer server = null;
    // Retrieve a reference to the MBeanServer
    server = (MBeanServer) ctx.lookup("");
    // Alternative BEA WebLogic-specific call of the MBean server
    // MBeanHome localHome = (MBeanHome) Helper.getAdminMBeanHome("username", "password", "url");  // e.g.  url="t3://localhost:7001"
    //server = localHome.getMBeanServer();
    // Create an ObjectName, change 'myserver' to your server name.
    ObjectName name = new ObjectName("mydomain:Name=org.jboss.cache,Type=TreeCache,Location=myserver");
    // Register the TreeCache Object in the MBeanServer
    server.registerMBean(_cache, name);     



    WebLogic 8.1:

    You can view the JBoss Cache MBean an JMX-Client like



    WebLogic 9.x:

    Should be able to view the MBean directly in the WebLogic console.