Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to know which managed server is currently hosted JMS server byJMX?

Status
Not open for further replies.

murthypatnaik

Programmer
Feb 26, 2006
15
US
Hi, We have JMS clustering across two managed servers in weblogic 8.1. Initially JMS server is targtted to first managed server. After that, I manually migrated JMS server to second managed server. In this scenario, How to know which managed server is currently hosted JMS server in pogrammatic way using JMX? Thanks in Advance, Murthy P
 
Does your JMS server expose any JMX methods or a remote listener ?

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
No, I have mentioned like following
******************
WebLogicObjectName aObjectName = new WebLogicObjectName("JMS0","JMSServer","patnaikJMS");
JMSServerMBean jmsServer = (JMSServerMBean)home.getMBean(aObjectName);
currentServer = jmsServer.getTargets()[0].getName();
System.out.println("JMS hosted server name::"+jmsServer.getTargets()[0].getName());
******************

It is always returning first managed server, even after jms server migration.

Thanks,
Murthy P
 
I got the solution, Following is the solution..thanks!

**************************************
ServerMBean candidateServer = null;

MigratableTargetMBean migratableTarget = null;

TargetMBean[] targets = jmsServer.getTargets();

if(targets != null && targets.length > 0)

{

boolean hostingServerRunning = false;

boolean candidateServerRunning = false;

if(targets[0] instanceof MigratableTargetMBean)

{

migratableTarget = (MigratableTargetMBean) targets[0];
ServerMBean[] candidates =
migratableTarget.getConstrainedCandidateServers();


if(candidates == null || candidates.length == 0)

candidates = migratableTarget.getAllCandidateServers();


if(candidates != null && candidates.length > 0)
{

ServerMBean hostingServer = migratableTarget.getHostingServer();
System.out.println("hosting server="+hostingServer.getName());
}
}
}
*********************************
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top