For example, the Spring sample at http://static.springframework.org/spring/docs/2.5.x/reference/jmx.html
works on WAS 6.0:
Interface:
package mysample.jmx;
public interface IJmxTestBean {
public int add(int x, int y);
public int getAge();
public void setAge(int age);
public void setName(String name);
public String getName();
}
And a basic class that implements this called JmxTestBean and the
following spring configuration successfully registers the mbean under
WAS 6.0:
<bean id="exporter"
class="org.springframework.jmx.export.MBeanExporter" lazy-
init="false">
<property name="beans">
<map>
<entry key="bean:name=testBean1" value-ref="testBean"/>
</map>
</property>
</bean>
<bean id="testBean" class="mysample.jmx.JmxTestBean">
<property name="name" value="TEST"/>
<property name="age" value="100"/>
</bean>
Using wsadmin and WAS 6.0 I can acess the mbean.
First test to see if it is registered:
wsadmin>$AdminControl isRegistered "bean:name=testBean1"
1
(1 means it's registered, 0 means it's not)
Secondly, the attributes:
wsadmin>$AdminControl getAttributes "bean:name=testBean1"
{Name TEST}
{Age 100}
Following the same procedure on WAS 6.1 and it doesn't work!
wsadmin>$AdminControl isRegistered "bean:name=testBean1"
0
wsadmin>$AdminControl getAttributes "bean:name=testBean1"
WASX7015E: Exception running command: "$AdminControl getAttributes
"bean:name=testBean1""; exception information:
javax.management.InstanceNotFoundException: bean:name=testBean1
I don't see any errors in the logs, and I added some logging to the
bean so I can see it being instantitated. After much Googling I
suspect that WAS 6.1 is changing the name of the mbean, but I can't
figure out to what.
wsadmin>$AdminControl isRegistered
"cell=myCellName,node=myNodeName,nodebean
:name=testBean1"
0
Any ideas? Has anyone successfully used an mbean using Spring on WAS
6.1?
Any one got any suggestions?
Thanks in Advance! :)
Sovled! Looks like the bean was being registered with the cellname,
nodename, & processname, appended to the end bean name (instead of to
the start of the name) . To query the mbean using wsadmin the
following worked:
$AdminControl isRegistered
"bean:name=testBean1,cell=CellName,node=NodeName,process=ProcessName"
I was able to determine this by using IBM's mBeanInspector for WAS
5.1. I was able to get it working with WAS 6.1 by using the procedure
I outlined at the end of this posting at IBM's Developerwork's forum:
http://www.ibm.com/developerworks/forums/thread.jspa?threadID=89830&tstart=0
For more detail see my reply on the Spring forum:
http://forum.springframework.org/showpost.php?p=166054&postcount=2