Bug 1058474 - Apache plug-in throws NoClassDefFoundError or UnsatisfiedLinkError when Augeas is enabled but library can not be read
Summary: Apache plug-in throws NoClassDefFoundError or UnsatisfiedLinkError when Augea...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Plugins
Version: 4.10
Hardware: All
OS: All
unspecified
medium
Target Milestone: ---
: RHQ 4.10
Assignee: Lukas Krejci
QA Contact: Mike Foley
URL:
Whiteboard:
: 855927 (view as bug list)
Depends On:
Blocks: 855926
TreeView+ depends on / blocked
 
Reported: 2014-01-27 21:07 UTC by Lukas Krejci
Modified: 2014-04-23 12:29 UTC (History)
4 users (show)

Fixed In Version:
Clone Of: 855926
Environment:
Last Closed: 2014-04-23 12:29:39 UTC
Embargoed:


Attachments (Terms of Use)

Description Lukas Krejci 2014-01-27 21:07:39 UTC
+++ This bug was initially created as a clone of Bug #855926 +++

Description of problem:
If Augeas support is enabled for an Apache Web Server resource and the Augeas library is missing, an exception is thrown without an explanation. 

WARN  [InventoryManager.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Failure during discovery for [Directory] Resources - failed after 86 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)
        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.UnsatisfiedLinkError: Unable to load library 'augeas': libaugeas.so: cannot open shared object file: No such file or directory
        at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:164)
        at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:237)
        at com.sun.jna.Library$Handler.<init>(Library.java:140)
        at com.sun.jna.Native.loadLibrary(Native.java:375)
        at com.sun.jna.Native.loadLibrary(Native.java:360)
        at net.augeas.jna.Aug.<clinit>(Unknown Source)
        at net.augeas.Augeas.<init>(Unknown Source)
        at net.augeas.Augeas.<init>(Unknown Source)
        at org.rhq.plugins.apache.ApacheServerComponent.isAugeasEnabled(ApacheServerComponent.java:1011)
        at org.rhq.plugins.apache.ApacheVirtualHostServiceComponent.isAugeasEnabled(ApacheVirtualHostServiceComponent.java:633)
        at org.rhq.plugins.apache.ApacheDirectoryDiscoveryComponent.discoverResources(ApacheDirectoryDiscoveryComponent.java:64)
        at sun.reflect.GeneratedMethodAccessor46.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)



 WARN  [InventoryManager.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Failure during discovery for [IfModule] Resources - failed after 0 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)
        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.NoClassDefFoundError: Could not initialize class net.augeas.jna.Aug
        at net.augeas.Augeas.<init>(Unknown Source)
        at net.augeas.Augeas.<init>(Unknown Source)
        at org.rhq.plugins.apache.ApacheServerComponent.isAugeasEnabled(ApacheServerComponent.java:1011)
        at org.rhq.plugins.apache.ApacheVirtualHostServiceComponent.isAugeasEnabled(ApacheVirtualHostServiceComponent.java:633)
        at org.rhq.plugins.apache.ApacheIfModuleDiscoveryComponent.discoverResources(ApacheIfModuleDiscoveryComponent.java:53)
        at sun.reflect.GeneratedMethodAccessor46.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



Version-Release number of selected component (if applicable):
3.1.0

How reproducible:
Always

Steps to Reproduce:
1. Import Apache server instance into inventory
2. Enable Augeas support from the Apache resource's Inventory > Connection Settings tab

If running on Linux:
3. Shut down the agent
4. Rename the <RHQ_AGENT_HOME>/lib/augeas directory to <RHQ_AGENT_HOME/lib/augeas.disabled
5. Start agent
  
Actual results:
Agent log will contain an warnings 
   java.lang.UnsatisfiedLinkError: Unable to load library 'augeas': libaugeas.so: cannot open shared object file: No such file or directory
   java.lang.NoClassDefFoundError: Could not initialize class net.augeas.jna.Aug

Expected results:
   The exception/error should show a message: Augeas is enabled in configuration but was not found on the system.

Additional info:
The cause of these unhandled exceptions is due to the exception type. We are explicitly catching all exceptions of type java.lang.Exception. However, these exceptions are of type java.lang.Error. We should either catch these specific errors an provide a meaningful message for each or catch java.lang.Throwable to catch all exceptions that could be generated during the isAugeasEnabled() call.

Comment 1 Lukas Krejci 2014-01-27 21:17:16 UTC
commit f7f0011072dd56f1a081aa24351966656ff94f83
Author: Lukas Krejci <lkrejci>
Date:   Mon Jan 27 22:12:25 2014 +0100

    [BZ 1058474] log meaningful messages on failure to find/link Augeas lib
    
    Catch NoClassDefFoundError and UnsatisfiedLinkError and report them
    appropriately when checking for presence of Augeas in Apache plugin.
    
    Also emit slightly more direct message if we do not support Augeas for
    given version of Apache.

Comment 2 Lukas Krejci 2014-01-27 21:22:09 UTC
*** Bug 855927 has been marked as a duplicate of this bug. ***

Comment 3 Heiko W. Rupp 2014-04-23 12:29:39 UTC
Bulk closing of 4.10 issues.

If an issue is not solved for you, please open a new BZ (or clone the existing one) with a version designator of 4.10.


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