Bug 1191727 - Management plug-in fails to discover managed servers if any of them use an expression for their auto-start or socket-binding-port-offset attributes
Summary: Management plug-in fails to discover managed servers if any of them use an ex...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Plugin -- JBoss EAP 6
Version: JON 3.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: post-GA
: One-off release
Assignee: Thomas Heute
QA Contact: Sunil Kondkar
URL:
Whiteboard:
Depends On:
Blocks: 1181217
TreeView+ depends on / blocked
 
Reported: 2015-02-11 20:19 UTC by Larry O'Leary
Modified: 2019-03-22 07:38 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
JBoss ON 3.3.0 JBoss EAP 6.3.0 Domain JBoss EAP 6 management plug-in version 4.12.0.JON330GA MD5 5f765ae677cdf0803566c8b77a34f5ce
Last Closed: 2016-01-28 13:29:31 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1072543 0 unspecified CLOSED Unable to collect metrics from EAP 6 datasources when a system properties is used in configuration 2021-02-22 00:41:40 UTC
Red Hat Knowledge Base (Solution) 1345283 0 None None None Never

Internal Links: 1072543

Description Larry O'Leary 2015-02-11 20:19:38 UTC
Description of problem:
If a variable/expression is used in a host's managed server configuration's attributes, it results in managed server discovery being aborted and no managed servers being discovered or imported for the parent host.

For example, from host.xml:

    <servers>
        <server name="server-one" group="main-server-group" auto-start="${server.autostart:true}">
            <socket-bindings port-offset="0"/>
        </server>
        <server name="server-two" group="main-server-group" auto-start="true">
            <socket-bindings port-offset="${server.portoffset.02:50}"/>
        </server>
        <server name="server-three" group="other-server-group" auto-start="${server.autostart:true}">
            <socket-bindings port-offset="${server.portoffset.03:100}"/>
        </server>
    </servers>

Such configuration would result in discovery failure. This is due to a type cast exception that provides very little details:

    Discovery for a ResourceType[id=0, name=Managed Server, plugin=JBossAS7, category=Server] failed for process  :java.util.LinkedHashMap cannot be cast to java.lang.Boolean

Version-Release number of selected component (if applicable):
3.3.0.GA Build Number: 4f16df3:e347f77

How reproducible:
Always

Steps to Reproduce:
1.  Install, configure, and start JBoss EAP 6.3 domain.
2.  Update the master host's managed server configuration for server-one to use a variable/property expression for its auto-start and port-offset attributes:

        # server-one
        /opt/jboss/eap/jboss-eap/bin/jboss-cli.sh --connect --command='/host=master/server-config=server-one:write-attribute(name=auto-start, value=${server.autostart:true})'
        /opt/jboss/eap/jboss-eap/bin/jboss-cli.sh --connect --command='/host=master/server-config=server-one:write-attribute(name=socket-binding-port-offset, value=${server.portoffset.01:0})'

3.  Confirm that the configuration was properly updated:

        /opt/jboss/eap/jboss-eap/bin/jboss-cli.sh --connect --command='/host=master/server-config=server-one:read-resource'
                ...
                "auto-start" => expression "${server.autostart:true}",
                ...
                "socket-binding-port-offset" => expression "${server.portoffset.01:0}",
                ...

4.  Restart the JBoss EAP domain for the changes to take affect.
5.  Install and start JBoss ON 3.3 system.
6.  Import the EAP Domain Controller (master 127.0.0.1:9990) JBossAS7 Host Controller resource from the discovery queue.
7.  Set the management user and password properties under the connection settings for the newly imported EAP Domain Controller resource.
8.  Invoke the platform resource's Run Autodiscovery operation with its Detailed Discovery parameter set to Yes.
9.  Wait for discovery operation to complete.

Actual results:
agent.log contains the following warning and managed server discovery is aborted and there are no managed resources discovered or auto-imported:

    WARN  [ResourceDiscoveryComponent.invoker.daemon-4] (rhq.modules.plugins.jbossas7.ManagedASDiscovery)- Discovery for a ResourceType[id=0, name=Managed Server, plugin=JBossAS7, category=Server] failed for process  :java.util.LinkedHashMap cannot be cast to java.lang.Boolean

If only socket-binding-port-offset is set to an expression, the same warning appears but the cast type is java.lang.Integer.

Expected results:
No error or warning related to "LinkedHashMap cannot be case to java.lang.*" and server-one, server-two, and server-three managed servers are all discovered and properly imported into inventory.

Additional info:
This bug is a result of blindly casting a de-typed return value to an incompatible type in ManagedASDiscovery.getManagedServers. Specifically:

193[2]:    info.autoStart = (Boolean) map.get("auto-start");
   194:    Integer offset = (Integer) map.get("socket-binding-port-offset");

This issue is similar to what was captured in Bug 1072543 in regards to metric collection.


[1]: https://github.com/rhq-project/rhq/blob/RHQ_4_12_0/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java#L175
[2]: https://github.com/rhq-project/rhq/blob/RHQ_4_12_0/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java#L193

Comment 1 Thomas Segismont 2015-02-13 10:33:48 UTC
Libor, can you please have a look?

Comment 2 Libor Zoubek 2015-02-16 14:33:56 UTC
branch:  master
link:    https://github.com/rhq-project/rhq/commit/289920aeb
time:    2015-02-16 15:29:48 +0100
commit:  289920aeb8d88c8a2a7f57f9a5327e3e2f19df39
author:  Libor Zoubek - lzoubek
message: Bug 1191727 - EAP 6 management plug-in fails to discover managed servers
         if any of them use an expression for their auto-start or 
         socket-binding-port-offset attributes
         Configuration loading for ManagedASComponent was updated so it
         also properly evaluates expressions. RHQ Server then stores
         already evaluated values, this would result overwriting
         expressions once configuration is updated.
         Resolve auto-start or offset attributes in case they're
         expressions. This commit also adds expressionResolver to
         BaseServerComponent for future use. Note: EAP operation
         :resolve-expression is not defined on domain controller in /
         address, but it is on individual /host=master host levels -
         thus evaluates the expression in host's context.

Comment 3 Simeon Pinder 2015-06-09 15:57:43 UTC
branch: release/jon3.3.x
commit: 63dcf1381d1e248c49ec248bea6dc264e23dc221
Author:     Libor Zoubek <lzoubek>
AuthorDate: Mon Feb 16 14:17:58 2015 +0100
Commit:     Simeon Pinder <spinder>
CommitDate: Tue Jun 9 10:15:22 2015 -0400

    Bug 1191727 - EAP 6 management plug-in fails to discover managed servers if

Moving to MODIFIED.

Comment 5 Sunil Kondkar 2015-06-16 14:43:54 UTC
Installed 3.3.0.GA Update 02 and applied Application Platform Plugin Pack Update-01
Verified that after following the steps, there is no error in agent log and all the three managed servers are discovered and imported into inventory.


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