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
Libor, can you please have a look?
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.
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.
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.