Uploaded image for project: 'Oozie'
  1. Oozie
  2. OOZIE-571

Oozie validate command doesnt work for schema 0.2

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • pre-Apache
    • None
    • None

    Description

      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

      Attachments

        Activity

          People

            virag Virag Kothari
            virag Virag Kothari
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: