Bug 893217 - [as5 plugin] Unable to collect metric from web application context due to WebApplicationContextComponent not initializing 'clustered' property value
Summary: [as5 plugin] Unable to collect metric from web application context due to Web...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Plugin -- JBoss EAP 5
Version: JON 3.1.1
Hardware: All
OS: All
urgent
high
Target Milestone: ER01
: JON 3.2.0
Assignee: Larry O'Leary
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On: 905183
Blocks: 905186
TreeView+ depends on / blocked
 
Reported: 2013-01-08 22:36 UTC by Larry O'Leary
Modified: 2018-11-30 20:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 894188 905183 905186 (view as bug list)
Environment:
Last Closed: 2014-01-02 20:34:29 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Screenshot (104.78 KB, image/png)
2013-10-21 13:21 UTC, Sunil Kondkar
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 837510 0 medium CLOSED NPE in AS5 plugin 2021-02-22 00:41:40 UTC

Internal Links: 837510

Description Larry O'Leary 2013-01-08 22:36:17 UTC
Description of problem:
Web application context metrics are not being collected and result in an NPE. This is a regression from JBoss ON 3.1.0. The metrics that seem to be affected are:

rejectedSessions, sessionMaxAliveTime, sessionCounter, expiredSessions, maxActive, sessionAverageAliveTime, activeSessions

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

How reproducible:
Always

Steps to Reproduce:
1.  Install and start EAP 5.1.2 server using all profile
2.  Start JBoss ON system
3.  Import EAP server into inventory
4.  Navigate to the *Monitoring* page of the //localhost/jxm-console web application context:

        <platform> / JBossAS Servers / EAP <host:port> all / Applications / Web Application (WAR)s / jmx-console.war / Web Application Contexts / //localhost/jmx-console > Monitoring 

5.  Enable the metric *Currently Active Sessions* and set its collection interval to 1 minute

It may take several minutes for the new value to take affect. It may simply be quicker to restart the agent at this point so that you can be certain that the new collection schedule will take affect.
  
Actual results:
No metrics appear in JBoss ON UI and agent logs the following error each time metric collection is attempted:

ERROR [ResourceContainer.invoker.daemon-5] (org.rhq.plugins.jbossas5.WebApplicationContextComponent)- Failed to collect metric 'activeSessions' for {JBossAS5}Web Application Context Resource with key localhost.
java.lang.NullPointerException
	at org.rhq.plugins.jbossas5.WebApplicationContextComponent.getValues(WebApplicationContextComponent.java:146)
	at sun.reflect.GeneratedMethodAccessor85.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:634)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:636)


Expected results:
Metrics should be collected normally and UI should reflect metrics.

Additional info:
This is a direct result of commit http://git.fedorahosted.org/cgit/rhq/rhq.git/commit/?id=88c286048d73a963eb2e2debd1009d8ed0d595b0 from bug 837510 is what breaks this. Prior to this commit, the variable clustered was initialized. However, this commit changed the type to an object without being initialized resulting in <null> being the default value whereas the existing code does not expect this. It appears that the initialization and retrieval of the web application context's clustered property was re-factored resulting in a non-initialized variable being used when attempting to retrieve the mentioned metrics.

Comment 1 Larry O'Leary 2013-01-08 23:20:41 UTC
Proposed fix based on master is on branch bug/893217 as commit http://git.fedorahosted.org/cgit/rhq/rhq.git/commit/?h=bug/893217&id=540d85287d3811cfea581e474b600f85ee7b4217.

Comment 2 Larry O'Leary 2013-01-28 19:20:36 UTC
Committed to master: http://git.fedorahosted.org/cgit/rhq/rhq.git/diff/?id=4403c93e9f56274644f397174582a0540c0195fc

commit 4403c93e9f56274644f397174582a0540c0195fc
Author: Larry O'Leary <loleary>
Date:   Tue Jan 8 16:59:11 2013 -0600

    Bug 905183 - [as5 plugin] Unable to collect metric from web application context due to WebApplicationContextComponent not initializing 'clustered' property value
    
    Added code to verify that clustered has been initialized and if it has not, an attempt is made to initialize it. Additionally, it will not be used if it is not initialized.

Comment 3 Sunil Kondkar 2013-10-21 13:20:48 UTC
Verified on Version: 3.2.0.ER3 Build Number: c0742ed:90dd474

Installed and started EAP 5.1.2 server using all profile. Followed the steps and verified that the metrics for 'Currently Active Sessions' are collected and UI reflects the metrics. Please refer the attached screenshot.
There are no errors in agent log.

Comment 4 Sunil Kondkar 2013-10-21 13:21:57 UTC
Created attachment 814601 [details]
Screenshot


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