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
Keywords:
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:
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)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 782915
: 1127873 (view as bug list)
Environment:
Last Closed: 2014-09-05 15:40:30 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 536138 0 medium CLOSED Agent fails to export the configuration 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 782915 0 medium ON_QA rhq-agent's config import does not work 2022-03-31 04:28:36 UTC
Red Hat Knowledge Base (Solution) 137893 0 None None None Never

Internal Links: 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>
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.