From case 234996 agent.log 718.4 KB 2008-10-30 15:02 CDT: 2008-10-30 12:25:09,926 WARN [InventoryManager.discovery-1] (org.rhq.plugins.jmx.JMXDiscoveryComponent)- Unable to complete base jmx server discovery - cause (enable DEBUG to see stack trace): java.lang.IllegalArgumentException: Resource name is longer than maximum length (500) [:/opt/jbinstall/access:/opt/db2admin/sqllib/java/db2jcc.jar:/opt/db2admin/sqllib/java/db2jcc_license_cisuz.jar:/opt/db2admin/sqllib/java/db2jcc_license_cu.jar:/usr/oracle/client/current/lib/ojdbc14.jar:/opt/mqm/java/lib/CL3Export.jar:/opt/mqm/java/lib/CL3Nonexport.jar:/opt/mqm/java/lib/dhbcore.jar:/opt/mqm/java/lib/rmm.jar:/opt/mqm/java/lib/connector.jar:/opt/mqm/java/lib/fscontext.jar:/opt/mqm/java/lib/jms.jar:/opt/mqm/java/lib/jndi.jar:/opt/mqm/java/lib/jta.jar:/opt/mqm/java/lib/ldap.jar:/opt/mqm/java/lib/com.ibm.mq.jar:/opt/mqm/java/lib/com.ibm.mqjms.jar:/opt/mqm/java/lib/providerutil.jar:/opt/adabas/connx/connxjdbc.jar:/opt/jbinstall/jboss-4.0.5.GA-B/bin/run.jar:/usr/java/jdk1.5.0_13/lib/tools.jar (3009)] 2008-10-30 12:25:09,928 INFO [InventoryManager.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Detected new Server [Resource[id=0, type=JMX Server, key=3002, name=:/opt/jbinstall/access:/opt/db2admin/sqllib/java/db2jcc.jar:/opt/db2admin/sqllib/java/db2jcc_license_cisuz.jar:/opt/db2admin/sqllib/java/db2jcc_license_cu.jar:/usr/oracle/client/current/lib/ojdbc14.jar:/opt/adabas/connx/connxjdbc.jar:/opt/jboss/bin/run.jar:/usr/java/jdk1.5.0_13/lib/tools.jar (3002)]] - adding to local inventory...
We could make the classpath a trait, but would probably need to make the trait column longer than it is currently
String name = null; for (int i = 1; i < process.getCommandLine().length; i++) { String arg = process.getCommandLine()[i]; if (!arg.startsWith("-")) { name = arg; break; } } name += " (" + port + ")"; Tries to take the first argument that doesn't start with - Which is why: "java -jar helloworld.jar" always produces a name of "helloworld.jar". If you start your VM like this: "java -cp long-classpath ...and the rest..." this bug will happen. We need to make auto-detecting the name better.
see also 237962
svn rev 2037 the code falls back to "JMX Server" if it can't find a suitable, short name. We automatically skip the classpath argument (-cp or -classpath).
need to test this
this is the code now: String name = "JMX Server"; for (int i = 1; i < process.getCommandLine().length; i++) { String arg = process.getCommandLine()[i]; if (!arg.startsWith("-")) { if (arg.length() < 200) { // don't use it if its really long, that's an ugly resource name name = arg; break; } } else if (arg.equals("-cp") || arg.equals("-classpath")) { i++; // skip the next arg, its the classpath, we don't want that as the name } } name += " (" + port + ")";
to workaround this problem (if running an older version that does not yet have this fix), set the classpath via an environment variable so you don't have to pass it on the command line: export CLASSPATH=/really/long:/class/path:/here java -jar -Dmy-options=here myjar.jar
svn ren 2267 in the 1.1.2.CP branch
Fixed, 2.1.2GA_CP1 <jweiss> this was my command: java -Dcom.sun.management.jmxremote.port=1500 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -cp .:/tmp:/usr/local/pgsql/include/server/access/:/usr/lib/acroread/Reader/Legal/en_US/::/tmp:/usr/local/pgsql/include/server/access/:/usr/lib/acroread/Reader/Legal/en_US/::/tmp:/usr/local/pgsql/include/server/access/:/usr/lib/acroread/Reader/Legal/en_US/::/tmp:/usr/local/pgsql/include/s erver/access/:/usr/lib/acroread/Reader/Legal/en_US/::/tmp:/usr/local/pgsql/include/server/access/:/usr/lib/acroread/Reader/Legal/en_US/::/tmp:/usr/local/pgsql/include/server/access/:/usr/lib/acroread/Reader/Legal/en_US/::/tmp:/usr/local/pgsql/include/server/access/:/usr/lib/acroread/Reader/Legal/en_US/::/tmp:/usr/local/pgsql/include/server/access/:/usr/lib/acroread/Reader/Legal/en_US/::/tmp:/usr/local/pgsql/include/server/access/:/usr/lib/acro read/Reader/Legal/en_US/: DummyJVM <ccrouch> jweiss if that actually launches a JVM then it should be a good test <jweiss> ccrouch: yeah, it did and it was discovered. mazz now what am i looking for to make sure everything is fixed i don't see any traits for the jvm <ccrouch> jweiss: the name of the resource not being 100's of characters long <mazz> I think the fact it made it into inventory is a good sign :) <ccrouch> +1 <jweiss> mazz: is the fix that it used the name of my class "DummyJVM" as the resource name? <mazz> yes. the name of the resource would have been that long classpath before which was obviously not what we wanted :) <jweiss> ok, so when i restart with --classpath, it's going to stay the same resource right? <mazz> if your resource name is valid now, then this is verified fixed correct
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-1036 This bug is related to RHQ-1104