org.springframework.jmx.MBeanServerNotFoundException Java Examples

The following examples show how to use org.springframework.jmx.MBeanServerNotFoundException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConnectorDelegate.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Connects to the remote {@code MBeanServer} using the configured {@code JMXServiceURL}:
 * to the specified JMX service, or to a local MBeanServer if no service URL specified.
 * @param serviceUrl the JMX service URL to connect to (may be {@code null})
 * @param environment the JMX environment for the connector (may be {@code null})
 * @param agentId the local JMX MBeanServer's agent id (may be {@code null})
 */
public MBeanServerConnection connect(@Nullable JMXServiceURL serviceUrl, @Nullable Map<String, ?> environment, @Nullable String agentId)
		throws MBeanServerNotFoundException {

	if (serviceUrl != null) {
		if (logger.isDebugEnabled()) {
			logger.debug("Connecting to remote MBeanServer at URL [" + serviceUrl + "]");
		}
		try {
			this.connector = JMXConnectorFactory.connect(serviceUrl, environment);
			return this.connector.getMBeanServerConnection();
		}
		catch (IOException ex) {
			throw new MBeanServerNotFoundException("Could not connect to remote MBeanServer [" + serviceUrl + "]", ex);
		}
	}
	else {
		logger.debug("Attempting to locate local MBeanServer");
		return JmxUtils.locateMBeanServer(agentId);
	}
}
 
Example #2
Source File: MBeanServerFactoryBean.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the {@code MBeanServer} instance.
 */
@Override
public void afterPropertiesSet() throws MBeanServerNotFoundException {
	// Try to locate existing MBeanServer, if desired.
	if (this.locateExistingServerIfPossible || this.agentId != null) {
		try {
			this.server = locateMBeanServer(this.agentId);
		}
		catch (MBeanServerNotFoundException ex) {
			// If agentId was specified, we were only supposed to locate that
			// specific MBeanServer; so let's bail if we can't find it.
			if (this.agentId != null) {
				throw ex;
			}
			logger.info("No existing MBeanServer found - creating new one");
		}
	}

	// Create a new MBeanServer and register it, if desired.
	if (this.server == null) {
		this.server = createMBeanServer(this.defaultDomain, this.registerWithFactory);
		this.newlyRegistered = this.registerWithFactory;
	}
}
 
Example #3
Source File: ConnectorDelegate.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Connects to the remote {@code MBeanServer} using the configured {@code JMXServiceURL}:
 * to the specified JMX service, or to a local MBeanServer if no service URL specified.
 * @param serviceUrl the JMX service URL to connect to (may be {@code null})
 * @param environment the JMX environment for the connector (may be {@code null})
 * @param agentId the local JMX MBeanServer's agent id (may be {@code null})
 */
public MBeanServerConnection connect(JMXServiceURL serviceUrl, Map<String, ?> environment, String agentId)
		throws MBeanServerNotFoundException {

	if (serviceUrl != null) {
		if (logger.isDebugEnabled()) {
			logger.debug("Connecting to remote MBeanServer at URL [" + serviceUrl + "]");
		}
		try {
			this.connector = JMXConnectorFactory.connect(serviceUrl, environment);
			return this.connector.getMBeanServerConnection();
		}
		catch (IOException ex) {
			throw new MBeanServerNotFoundException("Could not connect to remote MBeanServer [" + serviceUrl + "]", ex);
		}
	}
	else {
		logger.debug("Attempting to locate local MBeanServer");
		return JmxUtils.locateMBeanServer(agentId);
	}
}
 
Example #4
Source File: MBeanProxyFactoryBean.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Checks that the {@code proxyInterface} has been specified and then
 * generates the proxy for the target MBean.
 */
@Override
public void afterPropertiesSet() throws MBeanServerNotFoundException, MBeanInfoRetrievalException {
	super.afterPropertiesSet();

	if (this.proxyInterface == null) {
		this.proxyInterface = getManagementInterface();
		if (this.proxyInterface == null) {
			throw new IllegalArgumentException("Property 'proxyInterface' or 'managementInterface' is required");
		}
	}
	else {
		if (getManagementInterface() == null) {
			setManagementInterface(this.proxyInterface);
		}
	}
	this.mbeanProxy = new ProxyFactory(this.proxyInterface, this).getProxy(this.beanClassLoader);
}
 
Example #5
Source File: MBeanServerFactoryBean.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates the {@code MBeanServer} instance.
 */
@Override
public void afterPropertiesSet() throws MBeanServerNotFoundException {
	// Try to locate existing MBeanServer, if desired.
	if (this.locateExistingServerIfPossible || this.agentId != null) {
		try {
			this.server = locateMBeanServer(this.agentId);
		}
		catch (MBeanServerNotFoundException ex) {
			// If agentId was specified, we were only supposed to locate that
			// specific MBeanServer; so let's bail if we can't find it.
			if (this.agentId != null) {
				throw ex;
			}
			logger.info("No existing MBeanServer found - creating new one");
		}
	}

	// Create a new MBeanServer and register it, if desired.
	if (this.server == null) {
		this.server = createMBeanServer(this.defaultDomain, this.registerWithFactory);
		this.newlyRegistered = this.registerWithFactory;
	}
}
 
Example #6
Source File: ConnectorDelegate.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Connects to the remote {@code MBeanServer} using the configured {@code JMXServiceURL}:
 * to the specified JMX service, or to a local MBeanServer if no service URL specified.
 * @param serviceUrl the JMX service URL to connect to (may be {@code null})
 * @param environment the JMX environment for the connector (may be {@code null})
 * @param agentId the local JMX MBeanServer's agent id (may be {@code null})
 */
public MBeanServerConnection connect(JMXServiceURL serviceUrl, Map<String, ?> environment, String agentId)
		throws MBeanServerNotFoundException {

	if (serviceUrl != null) {
		if (logger.isDebugEnabled()) {
			logger.debug("Connecting to remote MBeanServer at URL [" + serviceUrl + "]");
		}
		try {
			this.connector = JMXConnectorFactory.connect(serviceUrl, environment);
			return this.connector.getMBeanServerConnection();
		}
		catch (IOException ex) {
			throw new MBeanServerNotFoundException("Could not connect to remote MBeanServer [" + serviceUrl + "]", ex);
		}
	}
	else {
		logger.debug("Attempting to locate local MBeanServer");
		return JmxUtils.locateMBeanServer(agentId);
	}
}
 
Example #7
Source File: MBeanProxyFactoryBean.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the {@code proxyInterface} has been specified and then
 * generates the proxy for the target MBean.
 */
@Override
public void afterPropertiesSet() throws MBeanServerNotFoundException, MBeanInfoRetrievalException {
	super.afterPropertiesSet();

	if (this.proxyInterface == null) {
		this.proxyInterface = getManagementInterface();
		if (this.proxyInterface == null) {
			throw new IllegalArgumentException("Property 'proxyInterface' or 'managementInterface' is required");
		}
	}
	else {
		if (getManagementInterface() == null) {
			setManagementInterface(this.proxyInterface);
		}
	}
	this.mbeanProxy = new ProxyFactory(this.proxyInterface, this).getProxy(this.beanClassLoader);
}
 
Example #8
Source File: MBeanServerFactoryBean.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Creates the {@code MBeanServer} instance.
 */
@Override
public void afterPropertiesSet() throws MBeanServerNotFoundException {
	// Try to locate existing MBeanServer, if desired.
	if (this.locateExistingServerIfPossible || this.agentId != null) {
		try {
			this.server = locateMBeanServer(this.agentId);
		}
		catch (MBeanServerNotFoundException ex) {
			// If agentId was specified, we were only supposed to locate that
			// specific MBeanServer; so let's bail if we can't find it.
			if (this.agentId != null) {
				throw ex;
			}
			logger.debug("No existing MBeanServer found - creating new one");
		}
	}

	// Create a new MBeanServer and register it, if desired.
	if (this.server == null) {
		this.server = createMBeanServer(this.defaultDomain, this.registerWithFactory);
		this.newlyRegistered = this.registerWithFactory;
	}
}
 
Example #9
Source File: MBeanProxyFactoryBean.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Checks that the {@code proxyInterface} has been specified and then
 * generates the proxy for the target MBean.
 */
@Override
public void afterPropertiesSet() throws MBeanServerNotFoundException, MBeanInfoRetrievalException {
	super.afterPropertiesSet();

	if (this.proxyInterface == null) {
		this.proxyInterface = getManagementInterface();
		if (this.proxyInterface == null) {
			throw new IllegalArgumentException("Property 'proxyInterface' or 'managementInterface' is required");
		}
	}
	else {
		if (getManagementInterface() == null) {
			setManagementInterface(this.proxyInterface);
		}
	}
	this.mbeanProxy = new ProxyFactory(this.proxyInterface, this).getProxy(this.beanClassLoader);
}
 
Example #10
Source File: ConnectorDelegate.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Connects to the remote {@code MBeanServer} using the configured {@code JMXServiceURL}:
 * to the specified JMX service, or to a local MBeanServer if no service URL specified.
 * @param serviceUrl the JMX service URL to connect to (may be {@code null})
 * @param environment the JMX environment for the connector (may be {@code null})
 * @param agentId the local JMX MBeanServer's agent id (may be {@code null})
 */
public MBeanServerConnection connect(@Nullable JMXServiceURL serviceUrl, @Nullable Map<String, ?> environment, @Nullable String agentId)
		throws MBeanServerNotFoundException {

	if (serviceUrl != null) {
		if (logger.isDebugEnabled()) {
			logger.debug("Connecting to remote MBeanServer at URL [" + serviceUrl + "]");
		}
		try {
			this.connector = JMXConnectorFactory.connect(serviceUrl, environment);
			return this.connector.getMBeanServerConnection();
		}
		catch (IOException ex) {
			throw new MBeanServerNotFoundException("Could not connect to remote MBeanServer [" + serviceUrl + "]", ex);
		}
	}
	else {
		logger.debug("Attempting to locate local MBeanServer");
		return JmxUtils.locateMBeanServer(agentId);
	}
}
 
Example #11
Source File: MBeanProxyFactoryBean.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Checks that the {@code proxyInterface} has been specified and then
 * generates the proxy for the target MBean.
 */
@Override
public void afterPropertiesSet() throws MBeanServerNotFoundException, MBeanInfoRetrievalException {
	super.afterPropertiesSet();

	if (this.proxyInterface == null) {
		this.proxyInterface = getManagementInterface();
		if (this.proxyInterface == null) {
			throw new IllegalArgumentException("Property 'proxyInterface' or 'managementInterface' is required");
		}
	}
	else {
		if (getManagementInterface() == null) {
			setManagementInterface(this.proxyInterface);
		}
	}
	this.mbeanProxy = new ProxyFactory(this.proxyInterface, this).getProxy(this.beanClassLoader);
}
 
Example #12
Source File: MBeanServerFactoryBean.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Creates the {@code MBeanServer} instance.
 */
@Override
public void afterPropertiesSet() throws MBeanServerNotFoundException {
	// Try to locate existing MBeanServer, if desired.
	if (this.locateExistingServerIfPossible || this.agentId != null) {
		try {
			this.server = locateMBeanServer(this.agentId);
		}
		catch (MBeanServerNotFoundException ex) {
			// If agentId was specified, we were only supposed to locate that
			// specific MBeanServer; so let's bail if we can't find it.
			if (this.agentId != null) {
				throw ex;
			}
			logger.debug("No existing MBeanServer found - creating new one");
		}
	}

	// Create a new MBeanServer and register it, if desired.
	if (this.server == null) {
		this.server = createMBeanServer(this.defaultDomain, this.registerWithFactory);
		this.newlyRegistered = this.registerWithFactory;
	}
}
 
Example #13
Source File: MBeanExportConfiguration.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public MBeanServer getMBeanServer() {
	try {
		return new JndiLocatorDelegate().lookup("java:comp/env/jmx/runtime", MBeanServer.class);
	}
	catch (NamingException ex) {
		throw new MBeanServerNotFoundException("Failed to retrieve WebLogic MBeanServer from JNDI", ex);
	}
}
 
Example #14
Source File: JmxUtils.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Attempt to find a locally running {@code MBeanServer}. Fails if no
 * {@code MBeanServer} can be found. Logs a warning if more than one
 * {@code MBeanServer} found, returning the first one from the list.
 * @param agentId the agent identifier of the MBeanServer to retrieve.
 * If this parameter is {@code null}, all registered MBeanServers are considered.
 * If the empty String is given, the platform MBeanServer will be returned.
 * @return the {@code MBeanServer} if found
 * @throws org.springframework.jmx.MBeanServerNotFoundException
 * if no {@code MBeanServer} could be found
 * @see javax.management.MBeanServerFactory#findMBeanServer(String)
 */
public static MBeanServer locateMBeanServer(String agentId) throws MBeanServerNotFoundException {
	MBeanServer server = null;

	// null means any registered server, but "" specifically means the platform server
	if (!"".equals(agentId)) {
		List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(agentId);
		if (servers != null && servers.size() > 0) {
			// Check to see if an MBeanServer is registered.
			if (servers.size() > 1 && logger.isWarnEnabled()) {
				logger.warn("Found more than one MBeanServer instance" +
						(agentId != null ? " with agent id [" + agentId + "]" : "") +
						". Returning first from list.");
			}
			server = servers.get(0);
		}
	}

	if (server == null && !StringUtils.hasLength(agentId)) {
		// Attempt to load the PlatformMBeanServer.
		try {
			server = ManagementFactory.getPlatformMBeanServer();
		}
		catch (SecurityException ex) {
			throw new MBeanServerNotFoundException("No specific MBeanServer found, " +
					"and not allowed to obtain the Java platform MBeanServer", ex);
		}
	}

	if (server == null) {
		throw new MBeanServerNotFoundException(
				"Unable to locate an MBeanServer instance" +
				(agentId != null ? " with agent id [" + agentId + "]" : ""));
	}

	if (logger.isDebugEnabled()) {
		logger.debug("Found MBeanServer: " + server);
	}
	return server;
}
 
Example #15
Source File: MBeanExportConfiguration.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public MBeanServer getMBeanServer() {
	try {
		return new JndiLocatorDelegate().lookup("java:comp/env/jmx/runtime", MBeanServer.class);
	}
	catch (NamingException ex) {
		throw new MBeanServerNotFoundException("Failed to retrieve WebLogic MBeanServer from JNDI", ex);
	}
}
 
Example #16
Source File: JmxUtils.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Attempt to find a locally running {@code MBeanServer}. Fails if no
 * {@code MBeanServer} can be found. Logs a warning if more than one
 * {@code MBeanServer} found, returning the first one from the list.
 * @param agentId the agent identifier of the MBeanServer to retrieve.
 * If this parameter is {@code null}, all registered MBeanServers are considered.
 * If the empty String is given, the platform MBeanServer will be returned.
 * @return the {@code MBeanServer} if found
 * @throws org.springframework.jmx.MBeanServerNotFoundException
 * if no {@code MBeanServer} could be found
 * @see javax.management.MBeanServerFactory#findMBeanServer(String)
 */
public static MBeanServer locateMBeanServer(String agentId) throws MBeanServerNotFoundException {
	MBeanServer server = null;

	// null means any registered server, but "" specifically means the platform server
	if (!"".equals(agentId)) {
		List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(agentId);
		if (servers != null && servers.size() > 0) {
			// Check to see if an MBeanServer is registered.
			if (servers.size() > 1 && logger.isWarnEnabled()) {
				logger.warn("Found more than one MBeanServer instance" +
						(agentId != null ? " with agent id [" + agentId + "]" : "") +
						". Returning first from list.");
			}
			server = servers.get(0);
		}
	}

	if (server == null && !StringUtils.hasLength(agentId)) {
		// Attempt to load the PlatformMBeanServer.
		try {
			server = ManagementFactory.getPlatformMBeanServer();
		}
		catch (SecurityException ex) {
			throw new MBeanServerNotFoundException("No specific MBeanServer found, " +
					"and not allowed to obtain the Java platform MBeanServer", ex);
		}
	}

	if (server == null) {
		throw new MBeanServerNotFoundException(
				"Unable to locate an MBeanServer instance" +
				(agentId != null ? " with agent id [" + agentId + "]" : ""));
	}

	if (logger.isDebugEnabled()) {
		logger.debug("Found MBeanServer: " + server);
	}
	return server;
}
 
Example #17
Source File: JmxUtils.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Attempt to find a locally running {@code MBeanServer}. Fails if no
 * {@code MBeanServer} can be found. Logs a warning if more than one
 * {@code MBeanServer} found, returning the first one from the list.
 * @param agentId the agent identifier of the MBeanServer to retrieve.
 * If this parameter is {@code null}, all registered MBeanServers are considered.
 * If the empty String is given, the platform MBeanServer will be returned.
 * @return the {@code MBeanServer} if found
 * @throws MBeanServerNotFoundException if no {@code MBeanServer} could be found
 * @see javax.management.MBeanServerFactory#findMBeanServer(String)
 */
public static MBeanServer locateMBeanServer(@Nullable String agentId) throws MBeanServerNotFoundException {
	MBeanServer server = null;

	// null means any registered server, but "" specifically means the platform server
	if (!"".equals(agentId)) {
		List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(agentId);
		if (!CollectionUtils.isEmpty(servers)) {
			// Check to see if an MBeanServer is registered.
			if (servers.size() > 1 && logger.isInfoEnabled()) {
				logger.info("Found more than one MBeanServer instance" +
						(agentId != null ? " with agent id [" + agentId + "]" : "") +
						". Returning first from list.");
			}
			server = servers.get(0);
		}
	}

	if (server == null && !StringUtils.hasLength(agentId)) {
		// Attempt to load the PlatformMBeanServer.
		try {
			server = ManagementFactory.getPlatformMBeanServer();
		}
		catch (SecurityException ex) {
			throw new MBeanServerNotFoundException("No specific MBeanServer found, " +
					"and not allowed to obtain the Java platform MBeanServer", ex);
		}
	}

	if (server == null) {
		throw new MBeanServerNotFoundException(
				"Unable to locate an MBeanServer instance" +
				(agentId != null ? " with agent id [" + agentId + "]" : ""));
	}

	if (logger.isDebugEnabled()) {
		logger.debug("Found MBeanServer: " + server);
	}
	return server;
}
 
Example #18
Source File: MBeanExportConfiguration.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public MBeanServer getMBeanServer() {
	try {
		return new JndiLocatorDelegate().lookup("java:comp/env/jmx/runtime", MBeanServer.class);
	}
	catch (NamingException ex) {
		throw new MBeanServerNotFoundException("Failed to retrieve WebLogic MBeanServer from JNDI", ex);
	}
}
 
Example #19
Source File: MBeanExportConfiguration.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public MBeanServer getMBeanServer() {
	try {
		return new JndiLocatorDelegate().lookup("java:comp/env/jmx/runtime", MBeanServer.class);
	}
	catch (NamingException ex) {
		throw new MBeanServerNotFoundException("Failed to retrieve WebLogic MBeanServer from JNDI", ex);
	}
}
 
Example #20
Source File: JmxUtils.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Attempt to find a locally running {@code MBeanServer}. Fails if no
 * {@code MBeanServer} can be found. Logs a warning if more than one
 * {@code MBeanServer} found, returning the first one from the list.
 * @param agentId the agent identifier of the MBeanServer to retrieve.
 * If this parameter is {@code null}, all registered MBeanServers are considered.
 * If the empty String is given, the platform MBeanServer will be returned.
 * @return the {@code MBeanServer} if found
 * @throws MBeanServerNotFoundException if no {@code MBeanServer} could be found
 * @see javax.management.MBeanServerFactory#findMBeanServer(String)
 */
public static MBeanServer locateMBeanServer(@Nullable String agentId) throws MBeanServerNotFoundException {
	MBeanServer server = null;

	// null means any registered server, but "" specifically means the platform server
	if (!"".equals(agentId)) {
		List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(agentId);
		if (!CollectionUtils.isEmpty(servers)) {
			// Check to see if an MBeanServer is registered.
			if (servers.size() > 1 && logger.isInfoEnabled()) {
				logger.info("Found more than one MBeanServer instance" +
						(agentId != null ? " with agent id [" + agentId + "]" : "") +
						". Returning first from list.");
			}
			server = servers.get(0);
		}
	}

	if (server == null && !StringUtils.hasLength(agentId)) {
		// Attempt to load the PlatformMBeanServer.
		try {
			server = ManagementFactory.getPlatformMBeanServer();
		}
		catch (SecurityException ex) {
			throw new MBeanServerNotFoundException("No specific MBeanServer found, " +
					"and not allowed to obtain the Java platform MBeanServer", ex);
		}
	}

	if (server == null) {
		throw new MBeanServerNotFoundException(
				"Unable to locate an MBeanServer instance" +
				(agentId != null ? " with agent id [" + agentId + "]" : ""));
	}

	if (logger.isDebugEnabled()) {
		logger.debug("Found MBeanServer: " + server);
	}
	return server;
}
 
Example #21
Source File: JmxUtils.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Attempt to find a locally running {@code MBeanServer}. Fails if no
 * {@code MBeanServer} can be found. Logs a warning if more than one
 * {@code MBeanServer} found, returning the first one from the list.
 * @return the {@code MBeanServer} if found
 * @throws MBeanServerNotFoundException if no {@code MBeanServer} could be found
 * @see javax.management.MBeanServerFactory#findMBeanServer
 */
public static MBeanServer locateMBeanServer() throws MBeanServerNotFoundException {
	return locateMBeanServer(null);
}
 
Example #22
Source File: MBeanServerFactoryBean.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Attempt to locate an existing {@code MBeanServer}.
 * Called if {@code locateExistingServerIfPossible} is set to {@code true}.
 * <p>The default implementation attempts to find an {@code MBeanServer} using
 * a standard lookup. Subclasses may override to add additional location logic.
 * @param agentId the agent identifier of the MBeanServer to retrieve.
 * If this parameter is {@code null}, all registered MBeanServers are
 * considered.
 * @return the {@code MBeanServer} if found
 * @throws org.springframework.jmx.MBeanServerNotFoundException
 * if no {@code MBeanServer} could be found
 * @see #setLocateExistingServerIfPossible
 * @see JmxUtils#locateMBeanServer(String)
 * @see javax.management.MBeanServerFactory#findMBeanServer(String)
 */
protected MBeanServer locateMBeanServer(String agentId) throws MBeanServerNotFoundException {
	return JmxUtils.locateMBeanServer(agentId);
}
 
Example #23
Source File: JmxUtils.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Attempt to find a locally running {@code MBeanServer}. Fails if no
 * {@code MBeanServer} can be found. Logs a warning if more than one
 * {@code MBeanServer} found, returning the first one from the list.
 * @return the {@code MBeanServer} if found
 * @throws org.springframework.jmx.MBeanServerNotFoundException
 * if no {@code MBeanServer} could be found
 * @see javax.management.MBeanServerFactory#findMBeanServer
 */
public static MBeanServer locateMBeanServer() throws MBeanServerNotFoundException {
	return locateMBeanServer(null);
}
 
Example #24
Source File: MBeanServerFactoryBean.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Attempt to locate an existing {@code MBeanServer}.
 * Called if {@code locateExistingServerIfPossible} is set to {@code true}.
 * <p>The default implementation attempts to find an {@code MBeanServer} using
 * a standard lookup. Subclasses may override to add additional location logic.
 * @param agentId the agent identifier of the MBeanServer to retrieve.
 * If this parameter is {@code null}, all registered MBeanServers are
 * considered.
 * @return the {@code MBeanServer} if found
 * @throws org.springframework.jmx.MBeanServerNotFoundException
 * if no {@code MBeanServer} could be found
 * @see #setLocateExistingServerIfPossible
 * @see JmxUtils#locateMBeanServer(String)
 * @see javax.management.MBeanServerFactory#findMBeanServer(String)
 */
protected MBeanServer locateMBeanServer(@Nullable String agentId) throws MBeanServerNotFoundException {
	return JmxUtils.locateMBeanServer(agentId);
}
 
Example #25
Source File: MBeanServerFactoryBean.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Attempt to locate an existing {@code MBeanServer}.
 * Called if {@code locateExistingServerIfPossible} is set to {@code true}.
 * <p>The default implementation attempts to find an {@code MBeanServer} using
 * a standard lookup. Subclasses may override to add additional location logic.
 * @param agentId the agent identifier of the MBeanServer to retrieve.
 * If this parameter is {@code null}, all registered MBeanServers are
 * considered.
 * @return the {@code MBeanServer} if found
 * @throws org.springframework.jmx.MBeanServerNotFoundException
 * if no {@code MBeanServer} could be found
 * @see #setLocateExistingServerIfPossible
 * @see JmxUtils#locateMBeanServer(String)
 * @see javax.management.MBeanServerFactory#findMBeanServer(String)
 */
protected MBeanServer locateMBeanServer(String agentId) throws MBeanServerNotFoundException {
	return JmxUtils.locateMBeanServer(agentId);
}
 
Example #26
Source File: JmxUtils.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Attempt to find a locally running {@code MBeanServer}. Fails if no
 * {@code MBeanServer} can be found. Logs a warning if more than one
 * {@code MBeanServer} found, returning the first one from the list.
 * @return the {@code MBeanServer} if found
 * @throws org.springframework.jmx.MBeanServerNotFoundException
 * if no {@code MBeanServer} could be found
 * @see javax.management.MBeanServerFactory#findMBeanServer
 */
public static MBeanServer locateMBeanServer() throws MBeanServerNotFoundException {
	return locateMBeanServer(null);
}
 
Example #27
Source File: JmxUtils.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Attempt to find a locally running {@code MBeanServer}. Fails if no
 * {@code MBeanServer} can be found. Logs a warning if more than one
 * {@code MBeanServer} found, returning the first one from the list.
 * @return the {@code MBeanServer} if found
 * @throws MBeanServerNotFoundException if no {@code MBeanServer} could be found
 * @see javax.management.MBeanServerFactory#findMBeanServer
 */
public static MBeanServer locateMBeanServer() throws MBeanServerNotFoundException {
	return locateMBeanServer(null);
}
 
Example #28
Source File: MBeanServerFactoryBean.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Attempt to locate an existing {@code MBeanServer}.
 * Called if {@code locateExistingServerIfPossible} is set to {@code true}.
 * <p>The default implementation attempts to find an {@code MBeanServer} using
 * a standard lookup. Subclasses may override to add additional location logic.
 * @param agentId the agent identifier of the MBeanServer to retrieve.
 * If this parameter is {@code null}, all registered MBeanServers are
 * considered.
 * @return the {@code MBeanServer} if found
 * @throws org.springframework.jmx.MBeanServerNotFoundException
 * if no {@code MBeanServer} could be found
 * @see #setLocateExistingServerIfPossible
 * @see JmxUtils#locateMBeanServer(String)
 * @see javax.management.MBeanServerFactory#findMBeanServer(String)
 */
protected MBeanServer locateMBeanServer(@Nullable String agentId) throws MBeanServerNotFoundException {
	return JmxUtils.locateMBeanServer(agentId);
}