|
#1
|
|||
|
|||
|
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? |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
Ya, I don't expect it to work out of the box, just wondering if anyone has used the MBeanExporter in WebSphere ...
|
|
#4
|
|||
|
|||
|
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 |
|
#6
|
|||
|
|||
|
any info from the WAS gurus
|
|
#7
|
|||
|
|||
|
Get ahold of WebSphere's admin service
Code:
<bean id="adminService" class="com.ibm.websphere.management.AdminServiceFactory" factory-method="getAdminService"/> 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"/> 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>
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>
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;
}
}
|
|
#8
|
||||
|
||||
|
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 |
|
#9
|
|||
|
|||
|
Where in the wikki should I add it?
|
|
#10
|
||||
|
||||
|
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 |
![]() |
| Thread Tools | |
| Display Modes | |
|
|