Bug 855926 - Apache plug-in throws NoClassDefFoundError or UnsatisfiedLinkError when Augeas is enabled but library can not be read
Apache plug-in throws NoClassDefFoundError or UnsatisfiedLinkError when Augea...
Status: CLOSED CURRENTRELEASE
Product: JBoss Operations Network
Classification: JBoss
Component: Plugin -- Apache (Show other bugs)
JON 3.1.0
All All
unspecified Severity medium
: DR01
: JON 3.2.1
Assigned To: Lukas Krejci
Mike Foley
:
Depends On: 855927 1058474
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-10 11:53 EDT by Larry O'Leary
Modified: 2014-05-08 13:43 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 855927 1058474 (view as bug list)
Environment:
Last Closed: 2014-05-08 13:43:36 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Larry O'Leary 2012-09-10 11:53:04 EDT
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 2 Lukas Krejci 2014-01-27 16:24:15 EST
In master by means of BZ 1058474
Comment 3 Thomas Segismont 2014-01-29 10:08:02 EST
Cherry-picked over to release/jon3.2.x

commit 80ab9efe5868ec5e12797a48166bbb3f251a8483
Author: Lukas Krejci <lkrejci@redhat.com>
Date:   Mon Jan 27 22:12:25 2014 +0100

    Bug 855926 - Apache plug-in throws NoClassDefFoundError or UnsatisfiedLinkError when Augeas is enabled but library can not be read
    
    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.
    
    (cherry picked from commit f7f0011072dd56f1a081aa24351966656ff94f83)
    Signed-off-by: Thomas Segismont <tsegismo@redhat.com>
Comment 4 Simeon Pinder 2014-02-18 10:08:08 EST
Moving to ON_QA as available for testing in the following brew build:
https://brewweb.devel.redhat.com//buildinfo?buildID=336752

Note: the installed version is still JON 3.2.0.GA by design and this represents part of the payload for JON 3.2.1 also known as cumulative patch 1 for 3.2.0.GA.  How this will be delivered to customers is still being discussed.
Comment 5 Sunil Kondkar 2014-02-20 09:35:44 EST
Verified on JON 3.2.1 DR01 build (Build Number :c758688:4c03150)

Followed the steps. Agent log has below message:

2014-02-20 14:51:01,294 ERROR [ResourceDiscoveryComponent.invoker.daemon-1] (org.rhq.plugins.apache.ApacheServerComponent)- Augeas is enabled in configuration but was not found on the system.
java.lang.UnsatisfiedLinkError: Unable to load library 'augeas': libaugeas.so: cannot open shared object file: No such file or directory
Comment 6 Mike Foley 2014-05-08 13:43:36 EDT
JON 3.2.1 released week of 5/5/2014

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