Oozie validate command doesnt work for schema 0.2 
--------------------------------------------------

                 Key: OOZIE-571
                 URL: https://issues.apache.org/jira/browse/OOZIE-571
             Project: Oozie
          Issue Type: Bug
            Reporter: Virag Kothari


Hi,

Validating the workflow using "oozie validate" command doesnt work with schema 
0.2

workflow.xml
========

<workflow-app xmlns='uri:oozie:workflow:0.2' name='pig-wf'>
    <start to='pig1' />
    <action name='pig1'>
        <pig>
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <configuration>
                <property>
                  <name>mapred.job.queue.name</name>
                  <value>${queueName}</value>
                </property>
            </configuration>
            <script>id.pig</script>
        </pig>
        <ok to='end' />
        <error to='fail' />
    </action>
    <kill name='fail'>
        <message>Pig failed, error 
message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <end name='end' />
</workflow-app>

=========

[anithar pig]$  oozie validate workflow.xml
Error: Invalid workflow-app, org.xml.sax.SAXParseException: cvc-elt.1: Cannot 
find the declaration of element
'workflow-app'.

This workflow.xml when run after putting in hdfs works good. 

The validate command works fine if the schema is 0.1.

=========
<workflow-app xmlns='uri:oozie:workflow:0.1' name='pig-wf'>
=========

[anithar pig]$  oozie validate workflow.xml
Valid worflow-app

I am assuming, from the code, i see that for the validate command, the schema 
is checked across only
oozie-workflow-0.1.xsd. This is the schema definition for 0.1.

------------
try {
                List<StreamSource> sources = new ArrayList<StreamSource>();
                sources.add(new 
StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream(
                        "oozie-workflow-0.1.xsd")));
                sources.add(new 
StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream(
                        "email-action-0.1.xsd")));
                sources.add(new 
StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream(
                        "distcp-action-0.1.xsd")));
                SchemaFactory factory = 
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
                Schema schema = factory.newSchema(sources.toArray(new 
StreamSource[sources.size()]));
                Validator validator = schema.newValidator();
                validator.validate(new StreamSource(new FileReader(file)));
                System.out.println("Valid worflow-app");
            }
catch (Exception ex) {
        throw new OozieCLIException("Invalid workflow-app, " + ex.toString(), 
ex);
            }
-------------

Regards,
Anitha


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to