Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Main class [org.apache.oozie.action.hadoop.SqoopMain], exit code [1]

Highlighted

Main class [org.apache.oozie.action.hadoop.SqoopMain], exit code [1]

New Contributor

When I run a Sqoop command from command line it is working fine. However when running from Oozie I get the following error :

Main class [org.apache.oozie.action.hadoop.SqoopMain], exit code [1]

Workflow.xml

<workflow-app name="sqoop_hive" xmlns="uri:oozie:workflow:0.4">
<global>
        <job-tracker>${jobTracker}</job-tracker>
        <name-node>${nameNode}</name-node>
        <configuration>
            <property>
                <name>mapred.job.queue.name</name>
                <value>${queueName}</value>
            </property>
            <property>
                <name>datanucleus.schema.autoCreateTables</name>
                <value>True</value>
            </property>
        </configuration>
</global>
    <credentials>
        <credential name="hs2-credentials" type="hive2">
            <property>
                <name>hive2.server.principal</name>
                <value>${jdbcPrincipal}</value>
            </property>
            <property>
                <name>hive2.jdbc.url</name>
                <value>${jdbcUrl}</value>
            </property>
        </credential>
        <credential name="hcatauth" type="hcat">
                   <property>
                       <name>hcat.metastore.principal</name>
                       <value>${jdbcPrincipal}</value>
                   </property>
                   <property>
                       <name>hive.metastore.uris</name>
                       <value>${jdbcUrl}</value>
                   </property>
               </credential>
           </credentials>
           <start to="sqoop-import"/>
           <action name="sqoop-import" cred="hcatauth">
               <sqoop xmlns="uri:oozie:sqoop-action:0.3">
                   <job-tracker>${jobTracker}</job-tracker>
                   <name-node>${nameNode}</name-node>
                  <command>import -Dorg.apache.sqoop.splitter.allow_text_splitter=true --connect "jdbc:sqlserver://XXXXXXXXXX;databaseName=XXXXX" --username xyz --password "abc" --query "SELECT name FROM table WHERE \$CONDITIONS" --split-by name-m 1 --target-dir "hdfs:///test"</command>
            <file>${hiveSiteXml}</file>
          </sqoop>
        <ok to="RemovePartition"/>
        <error to="Kill"/>
    </action>
    <action name="RemovePartition">
        <fs>
            <delete path="${nameNode}${DatabasePath}/process_date=${OUT_PROCESS_DATE}"/>
        </fs>
        <ok to="hive2"/>
        <error to="Kill"/>
    </action>
    <action name="hive2" cred="hs2-credentials">
        <hive2 xmlns="uri:oozie:hive2-action:0.1">
            <jdbc-url>${jdbcUrl}</jdbc-url>
            <script>${hiveScript}</script>
            <param>RAW_DB=${RawDatabase}</param>
            <param>STANDARDIZED_DB=${StandardizedDatabase}</param>
            <param>OUT_PROCESS_DATE=${OUT_PROCESS_DATE}</param>
            <param>PREVIOUS_DATE_FILTER=${PREVIOUS_DATE_FILTER}</param>
        </hive2>
        <ok to="HdfsFinish"/>
        <error to="Kill"/>
    </action>
    <action name="HdfsFinish">
        <fs>
            <touchz path="${nameNode}${DatabasePath}/process_date=${OUT_PROCESS_DATE}/_SUCCESS"/>
        </fs>
        <ok to="End"/>
        <error to="Kill"/>
    </action>
    <kill name="Kill">
        <message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <end name="End"/>
</workflow-app>

capture.png