Search in sources :

Example 21 with JMException

use of javax.management.JMException in project Payara by payara.

the class BootAMX method create.

/**
 *    Create an instance of the booter.
 */
public static synchronized BootAMX create(final ServiceLocator habitat, final MBeanServer server) {
    final BootAMX booter = new BootAMX(habitat, server);
    final ObjectName objectName = getBootAMXMBeanObjectName();
    try {
        final StandardMBean mbean = new StandardMBean(booter, BootAMXMBean.class);
        if (!server.registerMBean(mbean, objectName).getObjectName().equals(objectName)) {
            throw new IllegalStateException();
        }
    } catch (JMException e) {
        e.printStackTrace();
        throw new IllegalStateException(e);
    }
    return booter;
}
Also used : StandardMBean(javax.management.StandardMBean) JMException(javax.management.JMException) ObjectName(javax.management.ObjectName)

Example 22 with JMException

use of javax.management.JMException in project wso2-synapse by wso2.

the class FIXSessionFactory method initJMX.

private void initJMX(Connector connector, String service) {
    try {
        JmxExporter jmxExporter = new JmxExporter();
        jmxExporter.setRegistrationBehavior(JmxExporter.REGISTRATION_IGNORE_EXISTING);
        jmxExporter.export(connector);
    } catch (JMException e) {
        log.error("Error while initializing JMX support for the service: " + service, e);
    }
}
Also used : JmxExporter(org.quickfixj.jmx.JmxExporter) JMException(javax.management.JMException)

Example 23 with JMException

use of javax.management.JMException in project fabric8 by jboss-fuse.

the class MBeanRegistry method register.

/**
 * Registers a new MBean with the platform MBean server.
 * @param bean the bean being registered
 * @param parent if not null, the new bean will be registered as a child
 * node of this parent.
 */
public void register(ZKMBeanInfo bean, ZKMBeanInfo parent) throws JMException {
    assert bean != null;
    String path = null;
    if (parent != null) {
        path = mapBean2Path.get(parent);
        assert path != null;
    }
    path = makeFullPath(path, parent);
    mapBean2Path.put(bean, path);
    mapName2Bean.put(bean.getName(), bean);
    if (bean.isHidden())
        return;
    ObjectName oname = makeObjectName(path, bean);
    try {
        mBeanServer.registerMBean(bean, oname);
    } catch (JMException e) {
        LOG.warn("Failed to register MBean " + bean.getName());
        throw e;
    }
}
Also used : JMException(javax.management.JMException) ObjectName(javax.management.ObjectName)

Example 24 with JMException

use of javax.management.JMException in project fabric8 by jboss-fuse.

the class EnableJMXFeature method initialize.

@Override
public void initialize(Bus bus) {
    List<Server> servers = new ArrayList<Server>();
    ServerRegistry serverRegistry = bus.getExtension(ServerRegistry.class);
    servers.addAll(serverRegistry.getServers());
    for (Iterator<Server> iter = servers.iterator(); iter.hasNext(); ) {
        Server server = (Server) iter.next();
        ManagedApi mApi = new ManagedApi(bus, server.getEndpoint(), server);
        InstrumentationManager iMgr = bus.getExtension(InstrumentationManager.class);
        if (iMgr == null) {
            iMgr = new InstrumentationManagerImpl(bus);
        }
        ((InstrumentationManagerImpl) iMgr).setUsePlatformMBeanServer(true);
        ((InstrumentationManagerImpl) iMgr).setCreateMBServerConnectorFactory(false);
        ((InstrumentationManagerImpl) iMgr).setEnabled(true);
        ((InstrumentationManagerImpl) iMgr).init();
        if (iMgr != null) {
            try {
                iMgr.register(mApi);
            } catch (JMException jmex) {
                jmex.printStackTrace();
                LOG.log(Level.WARNING, "Registering ManagedApi failed.", jmex);
            }
        }
    }
}
Also used : InstrumentationManagerImpl(org.apache.cxf.management.jmx.InstrumentationManagerImpl) Server(org.apache.cxf.endpoint.Server) ArrayList(java.util.ArrayList) JMException(javax.management.JMException) ServerRegistry(org.apache.cxf.endpoint.ServerRegistry) InstrumentationManager(org.apache.cxf.management.InstrumentationManager)

Example 25 with JMException

use of javax.management.JMException in project fabric8 by jboss-fuse.

the class MXBeansProvider method activateInternal.

private void activateInternal() {
    MBeanServer server = mbeanServer.get();
    try {
        ProfileManagement profileMXBean = new ProfileManagementImpl();
        server.registerMBean(new StandardMBean(profileMXBean, ProfileManagement.class, true), new ObjectName(ProfileManagement.OBJECT_NAME));
    } catch (JMException ex) {
        throw new IllegalStateException(ex);
    }
}
Also used : ProfileManagement(io.fabric8.api.mxbean.ProfileManagement) StandardMBean(javax.management.StandardMBean) JMException(javax.management.JMException) MBeanServer(javax.management.MBeanServer) ObjectName(javax.management.ObjectName)

Aggregations

JMException (javax.management.JMException)114 ObjectName (javax.management.ObjectName)65 MBeanServer (javax.management.MBeanServer)35 IOException (java.io.IOException)21 InstrumentationManager (org.apache.cxf.management.InstrumentationManager)13 MalformedObjectNameException (javax.management.MalformedObjectNameException)12 MBeanInfo (javax.management.MBeanInfo)10 MBeanAttributeInfo (javax.management.MBeanAttributeInfo)8 SnmpStatusException (com.sun.management.snmp.SnmpStatusException)7 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)7 Map (java.util.Map)7 StandardMBean (javax.management.StandardMBean)7 RequiredModelMBean (javax.management.modelmbean.RequiredModelMBean)6 Date (java.util.Date)5 Attribute (javax.management.Attribute)5 InvalidTargetObjectTypeException (javax.management.modelmbean.InvalidTargetObjectTypeException)5 Element (org.w3c.dom.Element)5 PostConstruct (javax.annotation.PostConstruct)4 InstanceAlreadyExistsException (javax.management.InstanceAlreadyExistsException)4