+++ This bug was initially created as a clone of JBoss ON Bug #876656 +++ Description of problem: AS server discovery fails with the following exception: WARN [InventoryManager.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Failure during discovery for [JBossAS Server] Resources - failed after 20 ms. java.lang.Exception: Discovery component invocation failed. at org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:297) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:686) at org.rhq.core.pluginapi.util.ServerStartScriptDiscoveryUtility.getStartScriptIndex(ServerStartScriptDiscoveryUtility.java:295) at org.rhq.core.pluginapi.util.ServerStartScriptDiscoveryUtility.getStartScript(ServerStartScriptDiscoveryUtility.java:86) at org.rhq.plugins.jbossas5.ApplicationServerDiscoveryComponent.setStartScriptPluginConfigProps(ApplicationServerDiscoveryComponent.java:420) at org.rhq.plugins.jbossas5.ApplicationServerDiscoveryComponent.createResourceDetails(ApplicationServerDiscoveryComponent.java:407) at org.rhq.plugins.jbossas5.ApplicationServerDiscoveryComponent.discoverExternalJBossAsProcesses(ApplicationServerDiscoveryComponent.java:340) at org.rhq.plugins.jbossas5.ApplicationServerDiscoveryComponent.discoverResources(ApplicationServerDiscoveryComponent.java:170) at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:293) ... 5 more Version-Release number of selected component (if applicable): 4.4.0.JON310GA How reproducible: Always Steps to Reproduce: Not sure yet but the key is that the parent process of the AS JVM process needs to be something similar to the Linux init service. Actual results: Discovery of the AS server fails and the agent log contains a warning with the following exception: java.lang.StringIndexOutOfBoundsException: String index out of range: 0 Expected results: Discovery of the AS server should be successful and the AS start script should be unset. Additional info: This issue is a direct result of the parent process that started the JVM not being the expected run.sh or standalone.sh/domain.sh script. For example, if the user starts the JVM directly from the command-line without using a shell script; or as boot when the init system starts its configured services. In the case of the failure, the parent process command line is: init [3] Whereas, what we expect to see is: /bin/sh ./run.sh -c production -b 0.0.0.0 Simply put, ServerStartScriptDiscoveryUtility.getStartScriptIndex should not assume that the second argument (or any argument for that matter) has a length of 1 or more. - if (serverParentProcessCommandLine[startScriptIndex].charAt(0) != OPTION_PREFIX) { + if (serverParentProcessCommandLine[startScriptIndex] != null + && serverParentProcessCommandLine[startScriptIndex].length() > 0 + && serverParentProcessCommandLine[startScriptIndex].charAt(0) != OPTION_PREFIX) {
I think there is already a fix on master: edb9cf7 It was made by Jay 5 months ago but there is no BZ context in the commit comment. Jay, do you remember why you add to push this fix?
I didn't find any BZ associated with it either. Not sure it matters though. It is impacting customers and that should be enough. His fix also matches my proposed fix. We just need to get this back-ported to the product release branch for 3.1.2.
Bulk closing of issues in old RHQ releases that are in production for a while now. Please open a new issue when running into an issue.