This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours

Bug 771201

Summary: EPP 5.2 discovery fails with java.lang.StringIndexOutOfBoundsException
Product: [Other] RHQ Project Reporter: bkramer <bkramer>
Component: PluginsAssignee: Jay Shaughnessy <jshaughn>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: urgent    
Version: 4.2CC: hrupp, jshaughn, loleary, lzoubek, tfonteyn
Target Milestone: ---   
Target Release: JON 3.0.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 4.3 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 785851 (view as bug list) Environment:
Last Closed: 2013-09-03 11:16:38 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 781623, 781628, 781630, 785851, 798024    

Description bkramer 2012-01-02 07:35:49 EST
Description of problem:
Trying to discover and monitor EPP 5.2 with JON 3.0 but without success and the following is logged in the agent.log file:

2012-01-02 11:09:11,584 DEBUG [ResourceDiscoveryComponent.invoker.daemon-1] (rhq.plugins.jbossas.helper.JBossInstanceInfo)- Parsing JBossAS command line [/home/biljana/Java/jdk1.6.0_15/bin/java, -Dprogram.name=run.sh, -server, -Xms1303m, -Xmx1303m, -XX:MaxPermSize=256m, -Dorg.jboss.resolver.warning=true, -Dsun.rmi.dgc.client.gcInterval=3600000, -Dsun.rmi.dgc.server.gcInterval=3600000, -Dsun.lang.ClassLoader.allowArraySyntax=true, -Djava.net.preferIPv4Stack=true, -Djava.endorsed.dirs=/home/biljana/EPP/jboss-epp-5.2/jboss-as/lib/endorsed, -classpath, /home/biljana/EPP/jboss-epp-5.2/jboss-as/bin/run.jar:/home/biljana/Java/jdk1.6.0_15/lib/tools.jar, org.jboss.Main, -c, default, -b, 10.33.1.120]...
2012-01-02 11:09:11,595 ERROR [ResourceDiscoveryComponent.invoker.daemon-1] (org.rhq.plugins.jbossas.JBossASDiscoveryComponent)- Failed to process JBoss AS command line: [/home/biljana/Java/jdk1.6.0_15/bin/java, -Dprogram.name=run.sh, -server, -Xms1303m, -Xmx1303m, -XX:MaxPermSize=256m, -Dorg.jboss.resolver.warning=true, -Dsun.rmi.dgc.client.gcInterval=3600000, -Dsun.rmi.dgc.server.gcInterval=3600000, -Dsun.lang.ClassLoader.allowArraySyntax=true, -Djava.net.preferIPv4Stack=true, -Djava.endorsed.dirs=/home/biljana/EPP/jboss-epp-5.2/jboss-as/lib/endorsed, -classpath, /home/biljana/EPP/jboss-epp-5.2/jboss-as/bin/run.jar:/home/biljana/Java/jdk1.6.0_15/lib/tools.jar, org.jboss.Main, -c, default, -b, 10.33.1.120]
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(String.java:1937)
        at org.rhq.plugins.jbossas.helper.JBossInstallationInfo.<init>(JBossInstallationInfo.java:60)
        at org.rhq.plugins.jbossas.helper.JBossInstanceInfo.finalizeSysProps(JBossInstanceInfo.java:281)
        at org.rhq.plugins.jbossas.helper.JBossInstanceInfo.<init>(JBossInstanceInfo.java:86)
        at org.rhq.plugins.jbossas.JBossASDiscoveryComponent.processAutoDiscoveredProcesses(JBossASDiscoveryComponent.java:133)
        at org.rhq.plugins.jbossas.JBossASDiscoveryComponent.discoverResources(JBossASDiscoveryComponent.java:91)
        at sun.reflect.GeneratedMethodAccessor36.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:292)
        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:619)


When using EPP 5.1.1, the server is properly discovered.


Version-Release number of selected component (if applicable):
JON 3.0.0.GA + BZ761709.zip
EPP 5.2

How reproducible:
Always
  
Actual results:
EPP 5.2 is not discovered and java.lang.StringIndexOutOfBoundsException is logged in agent.log file.

Expected results:
EPP 5.2 is properly discovered by JON

Additional info:
Comment 1 Tom Fonteyne 2012-01-03 08:12:33 EST
run.jar MANIFEST entries:

Implementation-Version: 5.1.0 (build: SVNTag=JBPAPP_5_1_0 date=2010091
 50028)

Implementation-Version: JBoss-EPP 5.2.0.GA (build: SVNTag=5.2.0.GA dat
 e=201112080623)

http://jbosslxr.gsslab.fab.redhat.com/lxr/rhq/source//modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/helper/JBossInstallationInfo.java?v=3.0.0

org/rhq/plugins/jbossas5/helper/JBossInstallationInfo.java

115         int spaceIndex = validateImplementationVersion(implementationVersion);
116         String version = implementationVersion.substring(0, spaceIndex);

validateImplementationVersion() looks for the first space in the attribute, and treats that as version:

5.1.0
JBoss-EPP

So 5.2 detection fails
Comment 3 Jay Shaughnessy 2012-01-06 09:22:28 EST
master commit 38ca523ad95e2fdc3adec301fef5f88951c6dd2a

EPP 5.2 has changed the format of its Implementation-Version string in the
manifest (5.1.1 was different).  Add support for the new format. Also,
in general, fail more gracefully when encountering an unexpected version
string.


Test Notes:
Test EPP 5.2 discovery.  Ensure AS4 and AS5 plugins process correctly. AS4
should not throw errors (and should skip verthe process).  AS5 should not
throw errors and should discover an EPP 5.2 as an AS5 server resource. For
extra credit ensure that base EAP/AS/SOA 4,5 variants all still get
processed correctly.
Comment 5 Libor Zoubek 2012-01-30 13:45:04 EST
verified on Version: 3.0.1.GA Build Number: 784c8ce:5cde182
Comment 6 Charles Crouch 2012-01-30 14:06:58 EST
Removing RHQ4.3 from target version, we've got 785851 for that now.
Comment 7 Heiko W. Rupp 2013-09-03 11:16:38 EDT
Bulk closing of old issues in VERIFIED state.