Example usage for javax.management MBeanServer instantiate

List of usage examples for javax.management MBeanServer instantiate

Introduction

In this page you can find the example usage for javax.management MBeanServer instantiate.

Prototype

public Object instantiate(String className) throws ReflectionException, MBeanException;

Source Link

Document

Instantiates an object using the list of all class loaders registered in the MBean server's javax.management.loading.ClassLoaderRepository Class Loader Repository .

Usage

From source file:com.meltmedia.cadmium.deployer.JBossUtil.java

public static void addVirtualHost(String domain, Logger log) throws InstanceNotFoundException,
        MalformedObjectNameException, ReflectionException, MBeanException, NullPointerException {
    MBeanServer server = MBeanServerLocator.locateJBoss();
    boolean aliasFound = server.isRegistered(new ObjectName("jboss.web:type=Host,host=" + domain));
    if (!aliasFound) {
        log.info("Adding vHost {} to jboss", domain);
        Host host = (Host) server.instantiate("org.apache.catalina.core.StandardHost");
        host.setName(domain);//from   w  w w . java 2s . c  om

        server.invoke(new ObjectName("jboss.web:type=Engine"), "addChild", new Object[] { host },
                new String[] { "org.apache.catalina.Container" });
    }
}