Bug 1038728 - The agent's config export command produces an invalid XML file
Summary: The agent's config export command produces an invalid XML file
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Agent
Version: JON 3.1.2
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ER01
: JON 3.2.3
Assignee: Michael Burman
QA Contact: Mike Foley
URL:
Whiteboard:
Keywords: Triaged
Depends On: 782915
Blocks: 1127873
TreeView+ depends on / blocked
 
Reported: 2013-12-05 16:53 UTC by Larry O'Leary
Modified: 2018-12-03 20:53 UTC (History)
5 users (show)

(edit)
Clone Of: 782915
: 1127873 (view as bug list)
(edit)
Last Closed: 2014-09-05 15:40:30 UTC


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 137893 None None None Never
Red Hat Bugzilla 536138 None None None Never
Red Hat Bugzilla 782915 None None None Never

Internal Trackers: 536138 782915

Description Larry O'Leary 2013-12-05 16:53:37 UTC
Description of problem:
The agent's config export command produces an invalid XML file.

Bug 536138 introduced a change that results the DOCTYPE element being removed and no DTD being defined. This means that a config export from the agent produces a file that can not be imported back into the agent:

Failed to start the agent
java.lang.IllegalArgumentException: Failed to load configuration file [/tmp/00989956-agent-configuration-export.xml]. Cause: java.util.prefs.InvalidPreferencesFormatException: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 41; Document root element "preferences", must match DOCTYPE root "null".
	at org.rhq.enterprise.agent.AgentMain.processArguments(AgentMain.java:3155)
	at org.rhq.enterprise.agent.AgentMain.<init>(AgentMain.java:508)
	at org.rhq.enterprise.agent.AgentMain.main(AgentMain.java:404)


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

How reproducible:
Always

Steps to Reproduce:
1.  Install and configure JBoss ON agent.
2.  Launch agent command prompt:

        ${RHQ_AGENT_HOME}/bin/rhq-agent.sh -n
        
3.  Execute agent config export prompt command:

        config export /tmp/exported-agent-configuration.xml
        
4.  Exit agent command prompt.
5.  Re-configure agent using export configuration:

        ${RHQ_AGENT_HOME}/bin/rhq-agent.sh --cleanconfig --config /tmp/exported-agent-configuration.xml

6.  Validate /tmp/exported-agent-configuration.xml:

        xmllint --valid /tmp/exported-agent-configuration.xml


Actual results:
Agent fails to start:

    Failed to start the agent
    java.lang.IllegalArgumentException: Failed to load configuration file [/tmp/00989956-agent-configuration-export.xml]. Cause: java.util.prefs.InvalidPreferencesFormatException: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 41; Document root element "preferences", must match DOCTYPE root "null".
        at org.rhq.enterprise.agent.AgentMain.processArguments(AgentMain.java:3155)
        at org.rhq.enterprise.agent.AgentMain.<init>(AgentMain.java:508)
        at org.rhq.enterprise.agent.AgentMain.main(AgentMain.java:404)


xmllint reports:

    /tmp/exported-agent-configuration.xml:2: validity error : Validation failed: no DTD found !
    <preferences EXTERNAL_XML_VERSION="1.0">
                                           ^


Expected results:
Exported agent configuration file can be imported without error or validation warning.

Additional info:
As indicated in Bug 782915, this issue is a direct result of the work done in Bug 536138.

Comment 1 John Mazzitelli 2013-12-05 17:15:52 UTC
see bug #536138 and bug #782915 for some history on this issue.

Comment 2 John Mazzitelli 2013-12-05 17:17:23 UTC
HA! I didn't realize Larry alread mentioned those bugs from my last comment in his description - guess I should read the whole thing all the way through.

Comment 5 Michael Burman 2014-07-11 16:03:22 UTC
Fixed in master (includes unit test):

commit d6c14baa1bc2f4b8e63045abe10bf4d62878708c
Author: burmanm <miburman@redhat.com>
Date:   Fri Jul 11 19:00:06 2014 +0300

Comment 8 John Mazzitelli 2014-08-07 18:38:37 UTC
commit to release/jon3.2.x : fcc34701d5977e59f0c1d87366df9fd3438fb00c

Comment 9 Simeon Pinder 2014-08-15 03:19:06 UTC
Moving to ON_QA as this is available for test in JON 3.2.3 ER01 build:

http://jon01.mw.lab.eng.bos.redhat.com:8042/dist/release/jon/3.2.3.GA/8-14-14/


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