Create a bundle using the 'Upload a Recipe File' feature does not work on JON

Solution Verified - Updated -

Environment

  • JBoss Operations Network (JON) 2.4, 2.4.1, 2.4.2, 3.0, 3.0.1
  • Creating a Provisioning Bundle by uploading a bundle recipe file

Issue

  • Recipe will not accept input property within JON Bundle GUI console
  • When attempting to import a recipe file (Ant script) within the JBoss ON GUI console using the bundle resource, we receive the following error:

    java.lang.Exception:Failed to parse the bundle Ant script. -> org.apache.tools.ant.BuildException:rhq:input-property doesn't support the nested "deployment-unit" element. -> org.apache.tools.ant.UnsupportedElementException:The type doesn't support the nested "deployment-unit" element.
    
  • Create bundle using uploaded recipe file fails

  • Upload of recipe file fails if XML <element /> syntax is used as opposed to <element></element>

Resolution

This is a known issue as described in Bug 615978 and in the JON 2.4, JON 2.4.1, JON 2.4.2, and JON 3.0 release notes.

The workaround for creating a bundle from a recipe file is to copy the contents of the recipe file and paste it into the text field. For example:

  1. Log-in to JBoss ON GUI console
  2. Go to Administration > Content > Bundles
  3. Create a new bundle (click on New button) and select Recipe option
  4. Copy the contents of the recipe file and paste it into the text field
  5. Click on the Next button

Alternatively, the recipe can be added to a bundle archive as deploy.xml and will function just fine. If that is not an option, the recipe file can be updated to use the <element></element> notation. For example:

        ...
        <rhq:input-property
            name="jboss.home"
            description="JBoss Home"
            required="true"
            defaultValue="jboss-eap-5.1"
            type="string">
        </rhq:input-property>
        ...

Root Cause

The file parser implementation use is unable to properly handle the /> within the file. The result is the / is stripped from the file changing <element /> to <element >. The parser then expects to find the closing </element>.

Diagnostic Steps

  • The following deploy.xml demonstrates a file that will will result in the failure if uploaded as the recipe:

    <?xml version="1.0"?>
    
    <project name="example.com-website" default="main" 
             xmlns:rhq="antlib:org.rhq.bundle">    
    
       <rhq:bundle name="Guess"  version="9.0" description="Guess Bundle">
            <rhq:input-property name="jboss.home" description="JBoss Home"
                    required="true" defaultValue="jboss-eap-5.1" type="string"/>
    
            <rhq:deployment-unit name="application" manageRootDir="false">
                <rhq:archive name="guessv1.zip" />
            </rhq:deployment-unit>
        </rhq:bundle>
    
        <target name="main"/>
    </project>
    

    The offending elements are rhq:input-property and rhq:archive

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.