Description of problem: <groupId>org.rhq</groupId> <artifactId>rhq-jboss-as-7-jmx-util</artifactId> <packaging>jar</packaging> The plugin requires the client jar file to be accessible. This may not happen if you are testing using a remote server. The following will fix that: diff --git a/modules/plugins/jboss-as-7-jmx/src/main/java/org/rhq/modules/plugins/jbossas7/jmx/ApplicationMBeansDiscoveryComponent.java b/modules/plugins/jboss-as-7-jmx/src/main/java/org/rhq/modules/plugins/jbossas7/jmx/ApplicationMBeans index aa924a8..9212197 100644 --- a/modules/plugins/jboss-as-7-jmx/src/main/java/org/rhq/modules/plugins/jbossas7/jmx/ApplicationMBeansDiscoveryComponent.java +++ b/modules/plugins/jboss-as-7-jmx/src/main/java/org/rhq/modules/plugins/jbossas7/jmx/ApplicationMBeansDiscoveryComponent.java @@ -35,7 +35,6 @@ import org.mc4j.ems.connection.settings.ConnectionSettings; import org.mc4j.ems.connection.support.ConnectionProvider; import org.mc4j.ems.connection.support.metadata.JSR160ConnectionTypeDescriptor; - import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.configuration.PropertySimple; import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails; @@ -259,10 +258,10 @@ private PluginConfigProps() { File clientJarFile = new File(serverPluginConfiguration.getHomeDir(), "bin" + File.separator + "client" + File.separator + "jboss-client.jar"); if (!clientJarFile.isFile()) { - LOG.warn(clientJarFile + " does not exist."); - return Collections.emptySet(); - } + LOG.warn(clientJarFile + " does not exist in configured home directory. JMX connection will likely fail."); + } else { pluginConfig.setSimpleValue(CLIENT_JAR_LOCATION, clientJarFile.getAbsolutePath()); + } EmsConnection emsConnection = null; try { @@ -373,13 +372,17 @@ protected String getNewResourceVersion(Configuration pluginConfig) { * @return a new {@link EmsConnection} object or null if connecting failed */ public static EmsConnection loadEmsConnection(Configuration pluginConfig) { - EmsConnection emsConnection = null; try { - File clientJarFile = new File(pluginConfig.getSimpleValue(CLIENT_JAR_LOCATION)); - ConnectionSettings connectionSettings = new ConnectionSettings(); + String s = pluginConfig.getSimpleValue(CLIENT_JAR_LOCATION, ""); + File clientJarFile = new File(s); + if (clientJarFile.canRead()) { connectionSettings.initializeConnectionType(new A7ConnectionTypeDescriptor(clientJarFile)); connectionSettings.setLibraryURI(clientJarFile.getParent()); + } else { + connectionSettings.initializeConnectionType(new JSR160ConnectionTypeDescriptor()); + LOG.warn("cannot access client jar location " + clientJarFile); + } connectionSettings.setServerUrl( // "service:jmx:remoting-jmx://" // + pluginConfig.getSimpleValue(HOSTNAME) // @@ -398,9 +401,6 @@ public static EmsConnection loadEmsConnection(Configuration pluginConfig) { if (LOG.isDebugEnabled()) { LOG.debug("Could not create EmsConnection", e); } - if (emsConnection != null) { - emsConnection.close(); - } return null; } } The following doesn't really fix the situation, as it still attempts to connect to localhost using remoting-jmx: INFO 19-05 11:19:55,189 (EndpointImpl.java:<clinit>:69) -JBoss Remoting version (unknown) DEBUG 19-05 11:19:55,332 (ApplicationMBeansDiscoveryComponent.java:loadEmsConnection:402) -Could not create EmsConnection org.mc4j.ems.connection.EmsConnectException: Could not connect [service:jmx:remoting-jmx://localhost:10008] org.mc4j.ems.connection.EmsConnectException: IOException: Check servic e availability at org.mc4j.ems.impl.jmx.connection.support.providers.AbstractConnectionProvider.connect(AbstractConnectionProvider.java:106) at org.rhq.modules.plugins.jbossas7.jmx.ApplicationMBeansDiscoveryComponent.loadEmsConnection(ApplicationMBeansDiscoveryComponent.java:398) at org.rhq.modules.plugins.jbossas7.jmx.ApplicationMBeansDiscoveryComponent.discoverResources(ApplicationMBeansDiscoveryComponent.java:268) WildFly 8.1 uses http remoting as well. String url = "service:jmx:http-remoting-jmx://localhost:9990"; c.setSimpleValue(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY, url); c.setSimpleValue(JMXDiscoveryComponent.CONNECTION_TYPE, "org.mc4j.ems.connection.support.metadata.J2SE5ConnectionTypeDescriptor"); Version-Release number of selected component (if applicable): master a3c6d72a
This seems to fix the problem: https://github.com/genman/rhq/tree/BZ1099220 Also required: https://github.com/genman/ems/tree/P136
Fixed in master commit e1355eada75d609c8993e1b81fef72f4b80222ee Author: Thomas Segismont <tsegismo> Date: Tue May 27 13:56:54 2014 +0200 Updated port discovery (use HTTP management port with Wildfly standalone and HTTP application port with Wildfly managed servers in domain mode) Upadted remote JMX url builder (use "http-remoting-jmx" transport with Wildfly servers) Updated sample plugin POM file Tested on EAP6 standalone and domain Tested on Widfly 8.1.0.CR2 standalone and domain
Bulk close of items fixed in RHQ 4.12 If you think this is not solved, then please open a *new* BZ and link to this one.