Bug 873494 - [iis] Discovery of IIS VHost fails due to Win32Exception: MetaBaseInit: Can't CoCreateInstance from Sigar
[iis] Discovery of IIS VHost fails due to Win32Exception: MetaBaseInit: Can'...
Product: JBoss Operations Network
Classification: JBoss
Component: Plugin -- Other (Show other bugs)
JON 3.1.0
All Windows
unspecified Severity high
: ---
: JON 3.1.2
Assigned To: RHQ Project Maintainer
Mike Foley
Depends On: 873495
  Show dependency treegraph
Reported: 2012-11-05 21:10 EST by Larry O'Leary
Modified: 2012-11-20 18:00 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 873495 (view as bug list)
Microsoft Windows [Version 6.0.6002] 64-bit (Windows Server 2008 R2 Standard IIS 7.0.6000.16386 Oracle JVM 64-bit: Java(TM) SE Runtime Environment (build 1.6.0_31-b05) Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode) Oracle JVM 32-bit: Java(TM) SE Runtime Environment (build 1.6.0_37-b06) Java HotSpot(TM) Client VM (build 20.12-b01, mixed mode, sharing)
Last Closed: 2012-11-20 15:59:57 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 252973 None None None 2012-11-06 17:56:36 EST

  None (edit)
Description Larry O'Leary 2012-11-05 21:10:34 EST
Description of problem:
When service discovery is attempted for Microsoft IIS, it fails with the following exception:

    2012-11-06 03:49:11,644 WARN  [InventoryManager.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Failure during discovery for [VHost] Resources - failed after 281 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(Unknown Source)
	    at java.util.concurrent.FutureTask.run(Unknown Source)
	    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	    at java.lang.Thread.run(Unknown Source)
    Caused by: org.hyperic.sigar.win32.Win32Exception: MetaBaseInit:  Can't CoCreateInstance
	    at org.hyperic.sigar.win32.MetaBase.MetaBaseInit(Native Method)
	    at org.hyperic.sigar.win32.MetaBase.<init>(MetaBase.java:59)
	    at org.rhq.plugins.iis.util.IISMetaBase.getWebSites(IISMetaBase.java:75)
	    at org.rhq.plugins.iis.IISVHostDiscoveryComponent.discoverResources(IISVHostDiscoveryComponent.java:62)
	    at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
	    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	    at java.lang.reflect.Method.invoke(Unknown Source)
	    at org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:293)
	    ... 5 more

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

How reproducible:

Steps to Reproduce:
1. Install IIS on Windows Server 2008 R2 
2. Add ON agent to same machine
3. Import IIS server into ON inventory
4. Verify IIS server resource shows available in ON inventory
Actual results:
No child VHost resource listed under IIS server (by default, IIS 7+ adds a single default VHost. Additionally, the agent log will reveal a Sigar failure during discovery:
    org.hyperic.sigar.win32.Win32Exception: MetaBaseInit:  Can't CoCreateInstance

Expected results:
Default IIS VHost resource under IIS Server resource in navigation tree and no failure message.

Additional info:
This issue was reproduces on a Windows Server 2008 64-bit installation both with a 32-bit JVM and a 64-bit JVM to confirm that the same issue exists in both the 32-bit and 64-bit Sigar DLLs. Additionally the test was repeated with the Sigar libraries shipped with the ON 3.0 agent to confirm that a rebuild of the libraries did not introduce a regression.
Comment 1 Larry O'Leary 2012-11-05 21:38:03 EST
I did some quick looking and came up empty so far. Looking at the API, the method being invoked which causes this failure is win32_MetaBase_MetaBaseInit. Specifically:

    pIMeta = new (CComPtr <IMSAdminBase>);
    hRes = CoCreateInstance(CLSID_MSAdminBase, NULL, CLSCTX_ALL,
                            IID_IMSAdminBase, (void **)pIMeta);
    if (FAILED(hRes)) {
        jclass cls = env->FindClass(WIN32_PACKAGE "Win32Exception");
        env->ThrowNew(cls, "MetaBaseInit: Can't CoCreateInstance");
        return 0;

Perhaps this issue impacts only this version of IIS or this version of Windows? The steps I used to reproduce this used an IIS 7.0 server. The user who reported the error indicated they were using IIS 7.5. Perhaps we need to test this in another version of Windows too?
Comment 2 Amana 2012-11-06 12:10:11 EST
As described by Jiri Kremser, a workaround exists. I have performed some tests and it worked.

Basically you need to "install the IIS 6.0 Metabase Compatibility component from the IIS/Metabase Compatibility category in the Turn Windows Features On And Off page of Control Panel\Programs And Features on, or the IIS role in the Server Manager tool on Windows Server 2008."

    1) Go to Control Panel on Windows
    2) Click on Turn Windows features on or off
    3) In Server manager click on Roles
    4) Right-click on Web Server (IIS)
    5) Choose Add Role Services option
    6) Select IIS 6 Metabase Compatibility option and install
Comment 3 Larry O'Leary 2012-11-09 14:56:55 EST
Setting target back to 3.1.2 to see if we can get this into the next bug fix release.
Comment 4 Larry O'Leary 2012-11-20 18:00:09 EST
IIS 7.5 is not supported by plugin.

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