You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error running command: null
java.lang.ClassCastException
at java.lang.Class.cast(Class.java:2990)
at org.hyperic.hq.hqapi1.XmlUtil.deserialize(XmlUtil.java:68)
at org.hyperic.hq.hqapi1.tools.AlertDefinitionCommand.sync(AlertDefinitionCommand.java:439)
at org.hyperic.hq.hqapi1.tools.AlertDefinitionCommand.handleCommand(AlertDefinitionCommand.java:152)
at org.hyperic.hq.hqapi1.tools.Shell.dispatchCommand(Shell.java:244)
at org.hyperic.hq.hqapi1.tools.Shell.main(Shell.java:259)
Digging into the source, the issue seems to be that the sync method in AlertDefinitionCommand.java passes an object of type AlertDefinitionsResponse to XmlUtil.deserialize, which then attempts to cast it to an object of type AlertDefinitionResponse. I confirmed this by modifying the deserialize method in XmlUtil.java to have some debugging text:
When built and run with the same command, it produces the following output:
org.hyperic.hq.hqapi1.types.AlertDefinitionsResponse
org.hyperic.hq.hqapi1.types.AlertDefinitionResponse
Error running command: null
java.lang.ClassCastException
at java.lang.Class.cast(Class.java:2990)
at org.hyperic.hq.hqapi1.XmlUtil.deserialize(XmlUtil.java:68)
at org.hyperic.hq.hqapi1.tools.AlertDefinitionCommand.sync(AlertDefinitionCommand.java:439)
at org.hyperic.hq.hqapi1.tools.AlertDefinitionCommand.handleCommand(AlertDefinitionCommand.java:152)
at org.hyperic.hq.hqapi1.tools.Shell.dispatchCommand(Shell.java:244)
at org.hyperic.hq.hqapi1.tools.Shell.main(Shell.java:259)
This demonstrates that the res object is of type org.hyperic.hq.hqapi1.types.AlertDefinitionsResponse while the object returned by the JAXB unmarshaller is of type org.hyperic.hq.hqapi1.types.AlertDefinitionResponse.
The only workaround I have found so far is to manually change the root node of the XML to be synced to be AlertDefinitionsResponse instead of AlertDefinitionResponse, such as the following:
A note: The original XML was generated by hqapi.sh alertdefinition list and had two fields changed. The issue then is that the output from the HQAPI's alertdefinition list command cannot be synced back in with alertdefinition sync without further modification.
Attempting to sync the following XML via hqapi.sh alertdefinition sync --file produces the error immediately after it.
Error running command: null
java.lang.ClassCastException
at java.lang.Class.cast(Class.java:2990)
at org.hyperic.hq.hqapi1.XmlUtil.deserialize(XmlUtil.java:68)
at org.hyperic.hq.hqapi1.tools.AlertDefinitionCommand.sync(AlertDefinitionCommand.java:439)
at org.hyperic.hq.hqapi1.tools.AlertDefinitionCommand.handleCommand(AlertDefinitionCommand.java:152)
at org.hyperic.hq.hqapi1.tools.Shell.dispatchCommand(Shell.java:244)
at org.hyperic.hq.hqapi1.tools.Shell.main(Shell.java:259)
Digging into the source, the issue seems to be that the sync method in AlertDefinitionCommand.java passes an object of type AlertDefinitionsResponse to XmlUtil.deserialize, which then attempts to cast it to an object of type AlertDefinitionResponse. I confirmed this by modifying the deserialize method in XmlUtil.java to have some debugging text:
When built and run with the same command, it produces the following output:
org.hyperic.hq.hqapi1.types.AlertDefinitionsResponse
org.hyperic.hq.hqapi1.types.AlertDefinitionResponse
Error running command: null
java.lang.ClassCastException
at java.lang.Class.cast(Class.java:2990)
at org.hyperic.hq.hqapi1.XmlUtil.deserialize(XmlUtil.java:68)
at org.hyperic.hq.hqapi1.tools.AlertDefinitionCommand.sync(AlertDefinitionCommand.java:439)
at org.hyperic.hq.hqapi1.tools.AlertDefinitionCommand.handleCommand(AlertDefinitionCommand.java:152)
at org.hyperic.hq.hqapi1.tools.Shell.dispatchCommand(Shell.java:244)
at org.hyperic.hq.hqapi1.tools.Shell.main(Shell.java:259)
This demonstrates that the res object is of type org.hyperic.hq.hqapi1.types.AlertDefinitionsResponse while the object returned by the JAXB unmarshaller is of type org.hyperic.hq.hqapi1.types.AlertDefinitionResponse.
The only workaround I have found so far is to manually change the root node of the XML to be synced to be AlertDefinitionsResponse instead of AlertDefinitionResponse, such as the following:
This issue has also been reported here: http://communities.vmware.com/message/2164480
The text was updated successfully, but these errors were encountered: