Bug 856374 - JMX Plugin - Unsupported key type: Legacy
JMX Plugin - Unsupported key type: Legacy
Product: JBoss Operations Network
Classification: JBoss
Component: Plugin -- Other (Show other bugs)
JON 3.1.1
Unspecified Unspecified
high Severity medium
: ---
: JON 3.1.2
Assigned To: Simeon Pinder
Mike Foley
Depends On: 839087
  Show dependency treegraph
Reported: 2012-09-11 18:23 EDT by Simeon Pinder
Modified: 2013-09-11 07:04 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 839087
Last Closed: 2013-09-11 07:04:40 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Simeon Pinder 2012-09-11 18:23:38 EDT
+++ This bug was initially created as a clone of Bug #839087 +++

Description of problem:

If the process command line does not include the main class name (i.e. it was truncated) then the following may occur with the JMX plugin:

2012-07-10 21:39:22,315 DEBUG [ResourceDiscoveryComponent.invoker.daemon-1] (org.rhq.plugins.jmx.JMXDiscoveryComponent)- JMX service URL for java process [pro
cess: pid=[22589], name=[/usr/java/default/bin/java], ppid=[1]] is [service:jmx:rmi:///jndi/rmi://].
2012-07-10 21:39:22,316 DEBUG [ResourceDiscoveryComponent.invoker.daemon-1] (org.rhq.plugins.jmx.JMXDiscoveryComponent)- Using JMX remoting port [8013] as Resource key...
2012-07-10 21:39:22,316 DEBUG [ResourceDiscoveryComponent.invoker.daemon-1] (org.rhq.plugins.jmx.JMXDiscoveryComponent)- Error when trying to discover JVM pro
cess [ProcessScanResult: scan=[ProcessScan: query=[process|basename|match=^java.*,arg|-cp|match=.*/.../.*], name=[...]], info=[process: pid=[22589],
 name=[/usr/java/default/bin/java], ppid=[1]]].
java.lang.IllegalStateException: Unsupported key type: Legacy
        at org.rhq.plugins.jmx.JMXDiscoveryComponent.buildResourceName(JMXDiscoveryComponent.java:520)
        at org.rhq.plugins.jmx.JMXDiscoveryComponent.buildResourceDetails(JMXDiscoveryComponent.java:424)
        at org.rhq.plugins.jmx.JMXDiscoveryComponent.discoverResourceDetails(JMXDiscoveryComponent.java:415)
        at org.rhq.plugins.jmx.JMXDiscoveryComponent.discoverResources(JMXDiscoveryComponent.java:132)

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Create a command line that does not include a main class but includes a JMX port
2. Attempt to 'discover' this resource


diff --git a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXDiscoveryComponent.java b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXDisco
index f0a4f98..1937092 100644
--- a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXDiscoveryComponent.java
+++ b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXDiscoveryComponent.java
@@ -512,6 +512,9 @@ public class JMXDiscoveryComponent implements ResourceDiscoveryComponent, Manual
         switch (key.getType()) {
+            case Legacy:
+                // implies main classname was not found
+                name.append(key.getJmxRemotingPort()); break;
             case JmxRemotingPort:
                 name.append(':').append(key.getJmxRemotingPort()); break;
             case Explicit:

... I haven't tested this yet though

--- Additional comment from spinder@redhat.com on 2012-09-11 18:22:10 EDT ---

Hi Elias,

  This diff does solve the issue and I applied the diff with you as the committer.

This is fixed in master with commits:
Comment 1 Simeon Pinder 2012-09-11 18:25:52 EDT
These fixes should be applied to the appropriate release branches.  Discovery of the JMX server instances will fail if the main class name is not found.
Comment 2 Simeon Pinder 2012-11-30 15:59:37 EST
This is checked into the release/jon3.1.x branch with commits:

See BZ(https://bugzilla.redhat.com/show_bug.cgi?id=839087) for original commits and details description.

Moving this to MODIFIED awaiting a new ER build.
Comment 3 Simeon Pinder 2012-12-07 01:31:39 EST
Moving to ON_QA as available for testing in ER3 or greater: https://brewweb.devel.redhat.com/buildinfo?buildID=246689
Comment 4 Mike Foley 2013-01-14 18:36:59 EST
discussed with spinder.  this is not easily independtly QA'able.  QE has regression tested ALL the plugins for JON 3.1.2 ... which regression tests this change.  Based on having regression tested ALL plugins ... and having sign-offs from all QE leads in RH Middleware with a JON plugin ... I am marking this verified.

Note You need to log in before you can comment on or make changes to this bug.