JBoss ON not discovering JBoss AS/EAP due to getStartScriptIndex causing: String index out of range or ArrayIndexOutOfBoundsException

Solution Verified - Updated -

Issue

  • The agent.log shows the below error:

    ERROR [ResourceDiscoveryComponent.invoker.daemon-2902] (rhq.modules.plugins.jbossas7.StandaloneASDiscovery)- Discovery of a JBossAS7 Standalone Server Resource failed for process: pid=[4747], name=[/etc/alternatives/jre/bin/java], ppid=[1].
    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.modules.plugins.jbossas7.BaseProcessDiscovery.setStartScriptPluginConfigProps(BaseProcessDiscovery.java:251)
        at org.rhq.modules.plugins.jbossas7.BaseProcessDiscovery.buildResourceDetails(BaseProcessDiscovery.java:197)
        at org.rhq.modules.plugins.jbossas7.StandaloneASDiscovery.buildResourceDetails(StandaloneASDiscovery.java:84)
        at org.rhq.modules.plugins.jbossas7.BaseProcessDiscovery.discoverResources(BaseProcessDiscovery.java:136)
        at sun.reflect.GeneratedMethodAccessor42.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)
        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)
    
  • Not discovering JBoss Enterprise Application Platform (EAP) 5 Server Instances

  • I am getting the below exception in the log during discovery:

    INFO  [InventoryManager.discovery-1] (rhq.core.pc.inventory.AutoDiscoveryExecutor)- Executing server discovery scan...
    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)
            ...
    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
    
  • JBoss Application Server (AS) can not be discovered due to java.lang.StringIndexOutOfBoundsException: String index out of range: 0 error.

  • JBoss EAP not being added to the JBoss ON inventory

  • The agent throws an ArrayIndexOutOfBoundException while discovering the JBoss AS host controller.
  • Discovery of JBoss EAP server fails and the agent logs the following error:

    ERROR [ResourceDiscoveryComponent.invoker.daemon-1] (rhq.modules.plugins.jbossas7.HostControllerDiscovery)- Discovery of a JBossAS7 Host Controller Resource failed for process: pid=[1904], name=[java], ppid=[2496].
    java.lang.ArrayIndexOutOfBoundsException: 2
        at org.rhq.core.pluginapi.util.ServerStartScriptDiscoveryUtility.getStartScriptIndex(ServerStartScriptDiscoveryUtility.java:299)
        at org.rhq.core.pluginapi.util.ServerStartScriptDiscoveryUtility.getStartScript(ServerStartScriptDiscoveryUtility.java:86)
        at org.rhq.modules.plugins.jbossas7.BaseProcessDiscovery.setStartScriptPluginConfigProps(BaseProcessDiscovery.java:251)
        at org.rhq.modules.plugins.jbossas7.BaseProcessDiscovery.buildResourceDetails(BaseProcessDiscovery.java:197)
        at org.rhq.modules.plugins.jbossas7.BaseProcessDiscovery.discoverResources(BaseProcessDiscovery.java:136)
        at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:293)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
    

Environment

  • JBoss Operations Network (ON) 3.1.0, 3.1.1
  • JBoss Enterprise Application Platform (EAP) 5.1.2, 6.0
  • Discovery of one or more JBoss Application Server (AS) resources
  • JBoss AS resource was started without using standard shell script
    • using System V (SysV) init script
    • using Java command directly without invoking a shell script
    • using Windows service created by JBoss EAP native
    • using Java Service Wrapper

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content