*/
protected MQJMXConnectorInfo _getMQJMXConnectorInfoForCluster(
String target, JmsService jmsService, Class mqRAClassName, ServerContext serverContext)
throws ConnectorRuntimeException {
// Create a new RA instance.
ResourceAdapter raInstance = null;
// Set the ConnectionURL
MQAddressList list = null;
try {
if (jmsService.getType().equalsIgnoreCase(ActiveJmsResourceAdapter.REMOTE)) {
list = getDefaultAddressList(jmsService);
} else {
list = new MQAddressList();
CommandTarget ctarget = this.getTypeForTarget(target);
if (ctarget == CommandTarget.CLUSTER)
{
Server[] servers = list.getServersInCluster(target);
if (servers != null && servers.length > 0)
list.setInstanceName(servers[0].getName());
} else if (ctarget == CommandTarget.CLUSTERED_INSTANCE ){
list.setInstanceName(target);
}
java.util.Map<String,JmsHost> hostMap = list.getResolvedLocalJmsHostsInMyCluster(true);
if ( hostMap.size() == 0 ) {
String msg = localStrings.getLocalString("mqjmx.no_jms_hosts", "No JMS Hosts Configured");
throw new ConnectorRuntimeException(msg);
}
for (JmsHost host : hostMap.values()) {
list.addMQUrl(host);
}
}
String connectionUrl = list.toString();
String adminUserName = null;
String adminPassword = null;
JmsHost jmsHost = list.getDefaultJmsHost(jmsService);
if (jmsHost != null){// && jmsHost.isEnabled()) {
adminUserName = jmsHost.getAdminUserName();
adminPassword = JmsRaUtil.getUnAliasedPwd(jmsHost.getAdminPassword());
} else {
logger.log(Level.FINE, " _getMQJMXConnectorInfo, using default jms admin user and password ");
}
raInstance = getConfiguredRA(mqRAClassName, connectionUrl,
adminUserName, adminPassword);
} catch (Exception e) {
e.printStackTrace();
ConnectorRuntimeException cre = new ConnectorRuntimeException(e.getMessage());
cre.initCause(e);
throw cre;
}
try {
String jmxServiceURL = null, jmxServiceURLList = null;
Map<String, ?> jmxConnectorEnv = null;
Method[] methds = raInstance.getClass().getMethods();
for (int i = 0; i < methds.length; i++) {
Method m = methds[i];
if (m.getName().equalsIgnoreCase("get" + JMXSERVICEURLLIST)){
jmxServiceURLList = (String)m.invoke(raInstance, new Object[]{});
if (jmxServiceURLList != null && !jmxServiceURLList.trim().equals("")){