Announcement Announcement Module
Collapse
No announcement yet.
mbeans in WebSphere 6.0 & 6.0 different behaviour? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • mbeans in WebSphere 6.0 & 6.0 different behaviour?

    Using Spring I can successfully register an mBean on WAS 6.0, and then
    access it using wsadmin. On the WAS 6.1 the mbean seems to
    instantiate, but I can't call/access/see the mbean using WebSphere's wsadmin command-line interface.

    The Spring examples at http://static.springframework.org/sp...rence/jmx.html
    work easily on WAS 6.0.

    Using a basic 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, using this configuration (almost exactly the same as the Spring examples):

    Code:
    <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:
    Code:
    wsadmin>$AdminControl isRegistered "bean:name=testBean1"
    1
    (1 means it's registered, 0 means it's not)

    Secondly, the attributes:
    Code:
    wsadmin>$AdminControl getAttributes "bean:name=testBean1"
    {Name TEST}
    {Age 100}
    Following the same procedure on WAS 6.1 and it doesn't work!

    Code:
    wsadmin>$AdminControl isRegistered "bean:name=testBean1"
    0
    Code:
    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 that is it being instantiated.


    After reading this thread, I suspect that WAS is changing the name of the mbean, but any of the combinations I've tried have not worked. For example:
    Code:
    wsadmin>$AdminControl isRegistered
    "cell=myCellName,node=myNodeName,nodebean
    :name=testBean1"
    0
    Any ideas? Has anyone successfully created and registered an mbean using Spring on WebSphere 6.1? Any one got any suggestions?

    I also posted the same question over on the WebSphere google group, I'll keep both updated if I get a solution.
    Last edited by MickTimony; Feb 20th, 2008, 01:41 PM. Reason: Update title

  • #2
    Solved.

    Using IBM's mBeanInspector for WAS 5.1, I was able to get it working with WAS 6.1 (see my reply here ), and view the mbean and see that the name was registered as an "Un-typed MBean" whose name was in format:

    mbeanName,cellname,nodename,processname

    Which means to find our sample bean we would have to do:

    $AdminControl isRegistered "bean:name=testBean1,cell=CellName,node=NodeName,p rocess=ProcessName"

    You can find the Cell & Node names using the following arguments to AdminControl:

    $AdminControl getCell
    $AdminControl getNode

    The process name will likey be the name of server your connected to.

    Mick Timony

    Comment

    Working...
    X