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.
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.
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.
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.
Created attachment 814601 [details] Screenshot