Community   SpringSource   Projects    Downloads    Documentation    Forums    Training   Exchange   Blogs

Go Back   Spring Community Forums > Core Spring Projects > Spring Management

Reply
 
Thread Tools Display Modes
  #1  
Old Nov 9th, 2005, 06:46 PM
dritchey dritchey is offline
Junior Member
 
Join Date: Nov 2005
Posts: 5
Default Spring JMX in a distributed Websphere environment

Anyone have any expierence with Spring JMX on WebSphere 5.1 and willing share some code snippets? Its seems WebSphere requires you to jump through some hoops in terms of registering an MBean in a manner that will allow it to participate in a distributed environment (for example using the WebSphere specific AdminService or MBeanFactory).

The vanilla MBeanExporter works, but to use the MBean in a distributed environment, it looks like at minimum the object name needs to contain a type, the cell name, the node name, and process name. Anyone got any ideas?
Reply With Quote
  #2  
Old Nov 11th, 2005, 02:19 PM
robh robh is offline
Senior Member
Spring Modules TeamSpring Team
 
Join Date: Aug 2004
Location: Southampton, UK
Posts: 827
Default

I can't be sure that MBeanExporter will work in a distributed environment. The JMX spec doesn't really cover distribution currently so most vendors have their own custom solution.

Rob
__________________
Rob Harrop
Lead Engineer, dm Server
SpringSource
http://www.springsource.com

Co-Author - Pro Spring
Reply With Quote
  #3  
Old Nov 12th, 2005, 11:39 AM
dritchey dritchey is offline
Junior Member
 
Join Date: Nov 2005
Posts: 5
Default

Ya, I don't expect it to work out of the box, just wondering if anyone has used the MBeanExporter in WebSphere ...
Reply With Quote
  #4  
Old Nov 16th, 2005, 10:10 AM
bnewport bnewport is offline
Junior Member
 
Join Date: Mar 2005
Posts: 10
Default AdminService

The MBean needs to be 'declared' using the AdminService.activateMBean method. Then it becomes 'distributed'.

Note, JMX with WAS has the following features

A) If you want to connect to the DMgr from the JMX clients then the DMGR and the node agent on the node with the server hosting the MBean need to be running.

B) You can avoid this by attaching directly to the SOAP port on the JVM hosting the MBean but if the MBean moves from server to server, this doesn't work.

We're looking at fixing this in the future by allowing clients to connect to any JVM and find any MBean.

Billy (IBM)
http://www.billynewport.com
Reply With Quote
  #5  
Old Nov 16th, 2005, 06:11 PM
dritchey dritchey is offline
Junior Member
 
Join Date: Nov 2005
Posts: 5
Default

So it needs more than just having the the cell name, node name, and process name in the object name?

The article here seems to imply that if your object name is crafted correctly it'll work.
Reply With Quote
  #6  
Old Feb 7th, 2006, 06:06 AM
michaeljquinn michaeljquinn is offline
Junior Member
 
Join Date: Feb 2006
Posts: 1
Default Help, any response to this ?

any info from the WAS gurus
Reply With Quote
  #7  
Old Feb 7th, 2006, 06:27 PM
dritchey dritchey is offline
Junior Member
 
Join Date: Nov 2005
Posts: 5
Default The following worked

Get ahold of WebSphere's admin service

Code:
<bean id="adminService" class="com.ibm.websphere.management.AdminServiceFactory" factory-method="getAdminService"/>
Get the bits from the admin service needed for the object name.

Code:
<bean id="adminService.defaultDomain" class="org.springframework.beans.factory.config.PropertyPathFactoryBean"/>
<bean id="adminService.cellName" class="org.springframework.beans.factory.config.PropertyPathFactoryBean"/>
<bean id="adminService.nodeName" class="org.springframework.beans.factory.config.PropertyPathFactoryBean"/>
<bean id="adminService.processName" class="org.springframework.beans.factory.config.PropertyPathFactoryBean"/>
Create the WebSphere object naming strategy

Code:
<bean id="websphereNamingStrategy" class="WebsphereNamingStrategy">
    	<property name="domainName" ref="adminService.defaultDomain"/>
	<property name="cellName" ref="adminService.cellName"/>
	<property name="nodeName" ref="adminService.nodeName"/>
	<property name="processName" ref="adminService.processName"/>
</bean>
Export someBean with using the WebSphere object naming strategy.

Code:
<bean id="beanExporter" class="org.springframework.jmx.export.MBeanExporter">
    	<property name="beans">
      		<map>
        		<entry key="someBean" value-ref="someBean"/>
      		</map>
    	</property>
	<property name="namingStrategy" ref="websphereNamingStrategy"/>
 </bean>
WebSphere Object Naming Strategy. Creates an object name with the WebSphere required bits.

Code:
public class WebsphereNamingStrategy implements ObjectNamingStrategy 	
{
    private String domainName;
    private String cellName;
    private String nodeName;
    private String processName;
    
    public ObjectName getObjectName(Object object, String name)
        throws MalformedObjectNameException
    {
        StringBuffer objectName = new StringBuffer();
        objectName.append(domainName);
        objectName.append(":cell=");
        objectName.append(cellName);
        objectName.append(",name=");
        objectName.append(name);
        objectName.append(",type=");
        objectName.append(ClassUtils.getShortName(object.getClass()));
        objectName.append(",node=");
        objectName.append(nodeName);
        objectName.append(",process=");
        objectName.append(processName);
        

	return ObjectNameManager.getInstance(objectName.toString());
    }
    
    
    public String getCellName()
    {
        return cellName;
    }
    
    public void setCellName(String cellName)
    {
        this.cellName = cellName;
    }
    
    public String getDomainName()
    {
        return domainName;
    }
    
    public void setDomainName(String domainName)
    {
        this.domainName = domainName;
    }
    public String getNodeName()
    {
        return nodeName;
    }
    
    public void setNodeName(String nodeName)
    {
        this.nodeName = nodeName;
    }
    
    public String getProcessName()
    {
        return processName;
    }
    
    public void setProcessName(String processName)
    {
        this.processName = processName;
    }
}
Reply With Quote
  #8  
Old Feb 8th, 2006, 07:15 AM
Costin Leau's Avatar
Costin Leau Costin Leau is offline
Spring DM Lead
Spring Modules TeamSpring Team
 
Join Date: Jan 2005
Location: Bucharest, Romania
Posts: 5,015
Default

Can you post this on wiki? thanks.
__________________
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
Please use [ c o d e ] [ / c o d e ] tags
Reply With Quote
  #9  
Old Feb 8th, 2006, 06:25 PM
dritchey dritchey is offline
Junior Member
 
Join Date: Nov 2005
Posts: 5
Default

Where in the wikki should I add it?
Reply With Quote
  #10  
Old Feb 9th, 2006, 06:24 AM
Costin Leau's Avatar
Costin Leau Costin Leau is offline
Spring DM Lead
Spring Modules TeamSpring Team
 
Join Date: Jan 2005
Location: Bucharest, Romania
Posts: 5,015
Default

why not here: http://opensource2.atlassian.com/con...DOC/Spring+JMX ? Add it as a child page
__________________
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
Please use [ c o d e ] [ / c o d e ] tags
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 10:59 AM.


Contegix provides first-class managed hosting and partial sponsorship of these forums.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.