<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Metacosm &#187; jmx</title>
	<atom:link href="http://codepuccino.com/metacosm/tag/jmx/feed/" rel="self" type="application/rss+xml" />
	<link>http://codepuccino.com/metacosm</link>
	<description>This is not a tag line!</description>
	<lastBuildDate>Tue, 13 Apr 2010 15:24:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Accessing a JMX object programmatically from JBoss</title>
		<link>http://codepuccino.com/metacosm/2006/04/15/accessing-a-jmx-object-programmatically-from-jboss/</link>
		<comments>http://codepuccino.com/metacosm/2006/04/15/accessing-a-jmx-object-programmatically-from-jboss/#comments</comments>
		<pubDate>Sat, 15 Apr 2006 06:28:31 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[jboss]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jmx]]></category>

		<guid isPermaLink="false">http://blogs.codepuccino.com/metacosm/archives/2006/04/15/accessing-a-jmx-object-programmatically-from-jboss/</guid>
		<description><![CDATA[OK so here&#8217;s some geeky information&#8230; I&#8217;ve had several times the need to access a JMX service programmatically and each time, I had to hunt down the information so here it is so that I know where to find it next time. It took me three years almost to the days to need that piece


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>OK so here&#8217;s some geeky information&#8230; I&#8217;ve had several times the need to access a JMX service programmatically and each time, I had to hunt down the information so here it is so that I know where to find it next time.</p>
<p class="update" title="April 16, 2009">It took me three years almost to the days to need that piece of code again and realize that it wouldn&#8217;t even compile&#8230; Should be fixed now!</p>
<pre class="brush: java;">
import org.jboss.mx.util.MBeanProxy;
import org.jboss.mx.util.MBeanProxyCreationException;
import org.jboss.mx.util.MBeanServerLocator;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;

ObjectName objectName;
String name;
try {
	objectName = new ObjectName(name);
} catch (MalformedObjectNameException e) {
	throw new IllegalArgumentException(&quot;'&quot; + name + &quot;' is not a valid ObjectName&quot;);
}
MBeanServer server = MBeanServerLocator.locateJBoss();
try {
	return MBeanProxy.get(clazz, objectName, server);
} catch (MBeanProxyCreationException e) {
	String message = &quot;Couldn't retrieve '&quot; + objectName.getCanonicalName() + &quot;' MBean with class &quot; + clazz.getName();
	throw new RuntimeException(message, e);
}
</pre>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://codepuccino.com/metacosm/2006/04/15/accessing-a-jmx-object-programmatically-from-jboss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
