Bug 652247 - NPE in agent.log for resources to which connection cannot be established
Summary: NPE in agent.log for resources to which connection cannot be established
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Configuration
Version: 3.0.0
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
: ---
Assignee: Lukas Krejci
QA Contact: Corey Welton
URL:
Whiteboard:
Depends On:
Blocks: jon241-bugs
TreeView+ depends on / blocked
 
Reported: 2010-11-11 13:10 UTC by Sudhir D
Modified: 2011-05-24 01:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 653527 (view as bug list)
Environment:
Last Closed: 2011-05-24 01:11:34 UTC
Embargoed:


Attachments (Terms of Use)

Description Sudhir D 2010-11-11 13:10:57 UTC
Description of problem:
Null pointer exception is thrown in agent.log file for resources to which connection cannot be established.

Version-Release number of selected component (if applicable):
rhq-server-3.0.1-SNAPSHOT build# cd5a890

How reproducible:
Always

Steps to Reproduce:
1. Install rhq server and agent where tomcat and httpd is not correctly configured.
2. Monitor the agent.log

Actual results:
Null Pointer exception is thrown

Expected results:
NPE should not be thrown.

Additional info:
010-11-11 17:27:57,143 WARN  [ResourceContainer.invoker.daemon-3] (jboss.on.plugins.tomcat.TomcatServerComponent)- Could not establish connection to the Tomcat instance [11] times for resource [/root/Desktop/JON/apache-tomcat-5.5.29]
org.mc4j.ems.connection.EmsConnectException: Could not connect [null] java.lang.NullPointerException
        at org.mc4j.ems.impl.jmx.connection.support.providers.AbstractConnectionProvider.connect(AbstractConnectionProvider.java:102)
        at org.jboss.on.plugins.tomcat.TomcatServerComponent.loadConnection(TomcatServerComponent.java:222)
        at org.jboss.on.plugins.tomcat.TomcatServerComponent.getAvailability(TomcatServerComponent.java:343)
        at sun.reflect.GeneratedMethodAccessor45.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.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:525)
        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)
Caused by: java.lang.NullPointerException
        at javax.management.remote.JMXServiceURL.<init>(JMXServiceURL.java:122)
        at org.mc4j.ems.impl.jmx.connection.support.providers.JMXRemotingConnectionProvider.doConnect(JMXRemotingConnectionProvider.java:76)
        at org.mc4j.ems.impl.jmx.connection.support.providers.AbstractConnectionProvider.connect(AbstractConnectionProvider.java:97)
        ... 11 more
    :
    :
    :
    :
    :

Caused by: java.lang.NullPointerException
        at org.rhq.plugins.apache.ApacheVirtualHostServiceDiscoveryComponent.discoverResources(ApacheVirtualHostServiceDiscoveryComponent.java:147)
        at sun.reflect.GeneratedMethodAccessor37.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:279)
        ... 5 more

Comment 1 Lukas Krejci 2010-11-15 16:45:34 UTC
This is not a bug per se, because the error mentioned in the description happens during discovery that is independent of (and doesn't know about) the resources already in the inventory.

But it indeed looks a little bit confusing. I therefore changed the logging logic a bit to log this error only on the DEBUG level in case of automatic discoveries. 

In the case of manual discovery, this error will still get logged at INFO so that it ends up in the agent log by default.

commit b583eee673290900afac36b15e4e9a1ed590378d
Author: Lukas Krejci <lkrejci>
Date:   Mon Nov 15 17:08:24 2010 +0100

    BZ 651826 - Do not log the connection failures during auto-discovery on INFO level.

Comment 2 Lukas Krejci 2010-11-15 16:51:25 UTC
Please disregard the previous comment, I edited the wrong BZ :(

Comment 3 Lukas Krejci 2010-11-22 15:31:00 UTC
The first exception is actually not an NPE. The NPE is only the ultimate cause of it. The log entry and the stacktrace only inform about the failure to connect to the resource once per 10 connection attempts.

The other exception on the other hand will require a code fix.

Comment 4 Lukas Krejci 2010-11-23 21:15:39 UTC
commit ae99b5bc0bf42909308a9d1efc09cee77d06ffc1
Author: Lukas Krejci <lkrejci>
Date:   Tue Nov 23 22:09:27 2010 +0100

    a couple of robustness enhancements to the apache plugin:
    BZ 656449 - use the matching algorithm between SNMP values and augeas nodes also
      when matching the vhost node by resource key, because resource key
      in RHQ 3 is based on the SNMP value.
    BZ 652247 - Log the SNMP errors only on DEBUG level during discovery because SNMP isn't
      required for it to work.
    BZ 656476 - Do not fail the discovery if a non-existent directory is used in an Include directive
    BZ 652247, BZ 656491 - Do not choke on invalid/unresolvable hostnames in VirtualHost or ServerName directives

Comment 5 Sudhir D 2010-11-24 10:41:21 UTC
Verified on jon-server-2.4.1-SNAPSHOT build# ae99b5b. 

I don't see the above exception.

Marking this bug as verified.

Comment 6 Corey Welton 2011-05-24 01:11:34 UTC
Bookkeeping - closing bug - fixed in recent release.

Comment 7 Corey Welton 2011-05-24 01:11:34 UTC
Bookkeeping - closing bug - fixed in recent release.


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