<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Cloudera 5.4.x oozie Custom Actions, how to use scala main classes? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Cloudera-5-4-x-oozie-Custom-Actions-how-to-use-scala-main/m-p/28248#M6179</link>
    <description>&lt;P&gt;Please forgive me if this appears twice, the forum claimed to discard my last message after successful preview and an attempt to post it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an oozie custom action on the Cloudera Quickstart 5.4.x VM, with an associated main class. &amp;nbsp;The main class is in scala (for intereoperability with a framework), and I'm having some challenges during testing. &amp;nbsp;Before going too deep into the details I would like to ask the following questions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;What is the recommended approach for the custom action executor to resolve the class name of the main class, particularly if the main class is written in scala?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;What is the automated and recommended way to determine what (if any) dependencies must be provided with (i) the custom action and (ii) the main class?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;What is the recommended way to package the dependencies (e.g. put extra jars in the directory, use a shadow/fat jar)?&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The details follow for a simplified sanitized version of what I'm dealing with that shows the salient features.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, let's consider the custom action executor, whch has the following structure, please note the labeled problematic line impacted at runtime by the presence/absence of dependencies.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;package &lt;/SPAN&gt;org.apache.oozie.action.hadoop&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;// all the imports are shown&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.apache.action.hadoop.MyScalaShellMain&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.apache.hadoop.conf.Configuration&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.apache.hadoop.fs.Path&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.apache.oozie.action.ActionExecutorException&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.jdom.Element&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.jdom.Namespace&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;java.util.List&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;public class &lt;/SPAN&gt;MyShellActionExecutor &lt;SPAN&gt;extends &lt;/SPAN&gt;JavaActionExecutor {&lt;BR /&gt;// stuff deleted&lt;BR /&gt;    &lt;SPAN&gt;@Override&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;protected &lt;/SPAN&gt;String &lt;SPAN&gt;getLauncherMain&lt;/SPAN&gt;(Configuration launcherConf&lt;SPAN&gt;, &lt;/SPAN&gt;Element actionXml) {&lt;BR /&gt;        &lt;SPAN&gt;final &lt;/SPAN&gt;String classNameToLaunch = MyScalaShellMain.&lt;SPAN&gt;class&lt;/SPAN&gt;.getName()&lt;SPAN&gt;; // This line fails without installing additional dependencies&lt;BR /&gt;&lt;/SPAN&gt;        &lt;SPAN&gt;LOG&lt;/SPAN&gt;.info(&lt;SPAN&gt;"getLauncherMain, classNameToLaunch = &lt;/SPAN&gt;&lt;SPAN&gt;\"&lt;/SPAN&gt;&lt;SPAN&gt;" &lt;/SPAN&gt;+ classNameToLaunch + &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;\"&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        return &lt;/SPAN&gt;launcherConf.get(LauncherMapper.&lt;SPAN&gt;CONF_OOZIE_ACTION_MAIN_CLASS&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;MyScalaShellMain.&lt;SPAN&gt;class&lt;/SPAN&gt;.getName())&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    }&lt;BR /&gt;&lt;BR /&gt;// more stuff deleted&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;The MyScalaShellMain class is a scala class with a companion object (to support the static main method), with the following structure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;package &lt;/SPAN&gt;org.apache.action.hadoop&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;java.io._&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;java.util&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;com.typesafe.scalalogging.Logging&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;com.typesafe.scalalogging.slf4j.Logger&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.slf4j.LoggerFactory&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;scala.collection.JavaConverters._&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.apache.hadoop.conf.Configuration&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.apache.hadoop.fs.Path&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.apache.hadoop.util.Shell&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.apache.oozie.action.hadoop._&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;com.typesafe.scalalogging&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;class &lt;/SPAN&gt;MyScalaShellMain &lt;SPAN&gt;extends &lt;/SPAN&gt;LauncherMain &lt;SPAN&gt;with &lt;/SPAN&gt;Logging {&lt;BR /&gt;  &lt;SPAN&gt;val &lt;/SPAN&gt;&lt;SPAN&gt;logger &lt;/SPAN&gt;= &lt;SPAN&gt;Logger&lt;/SPAN&gt;(LoggerFactory.&lt;SPAN&gt;getLogger&lt;/SPAN&gt;(getClass))&lt;BR /&gt;  &lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;  &lt;SPAN&gt;@throws&lt;/SPAN&gt;(classOf[Exception])&lt;BR /&gt;  &lt;SPAN&gt;protected def &lt;/SPAN&gt;&lt;SPAN&gt;run&lt;/SPAN&gt;(args: Array[&lt;SPAN&gt;String&lt;/SPAN&gt;]) {&lt;BR /&gt;    System.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;s"""run(args = &lt;/SPAN&gt;&lt;SPAN&gt;$&lt;/SPAN&gt;{args}&lt;SPAN&gt;) invoked"""&lt;/SPAN&gt;)&lt;BR /&gt;    &lt;SPAN&gt;val &lt;/SPAN&gt;actionConf: Configuration = loadActionConf&lt;BR /&gt;    System.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;"run, Before execute, actionConf = " &lt;/SPAN&gt;+ actionConf.toString)&lt;BR /&gt;    &lt;SPAN&gt;val &lt;/SPAN&gt;exitCode: &lt;SPAN&gt;Int &lt;/SPAN&gt;= execute(actionConf)&lt;BR /&gt;    System.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;"run After Execute, exitcode = "&lt;/SPAN&gt;)&lt;BR /&gt;    &lt;SPAN&gt;if &lt;/SPAN&gt;(exitCode != &lt;SPAN&gt;0&lt;/SPAN&gt;) {&lt;BR /&gt;      &lt;SPAN&gt;throw new &lt;/SPAN&gt;MyLauncherMainException(&lt;SPAN&gt;1&lt;/SPAN&gt;)&lt;BR /&gt;    }&lt;BR /&gt;  }&lt;BR /&gt;// stuff deleted&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/**&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt; * Companion object&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt; */&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;object &lt;/SPAN&gt;MyScalaShellMain{&lt;BR /&gt;  &lt;SPAN&gt;/**&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;   * &lt;/SPAN&gt;&lt;SPAN&gt;@param args &lt;/SPAN&gt;&lt;SPAN&gt;Invoked from LauncherMapper:map()&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;   * &lt;/SPAN&gt;&lt;SPAN&gt;@throws &lt;/SPAN&gt;&lt;SPAN&gt;Exception&lt;BR /&gt;&lt;/SPAN&gt;   &lt;SPAN&gt;*/&lt;BR /&gt;&lt;/SPAN&gt;  &lt;SPAN&gt;@throws&lt;/SPAN&gt;(classOf[Exception])&lt;BR /&gt;  &lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;main&lt;/SPAN&gt;(args: Array[&lt;SPAN&gt;String&lt;/SPAN&gt;]): &lt;SPAN&gt;Unit &lt;/SPAN&gt;= {&lt;BR /&gt;    System.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;"Starting main(args =  " &lt;/SPAN&gt;+ args + &lt;SPAN&gt;")"&lt;/SPAN&gt;)&lt;BR /&gt;    System.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;"The object's name is " &lt;/SPAN&gt;+ &lt;SPAN&gt;this&lt;/SPAN&gt;.getClass.getName)&lt;BR /&gt;    &lt;SPAN&gt;val &lt;/SPAN&gt;mssm = &lt;SPAN&gt;new &lt;/SPAN&gt;MyScalaShellMain&lt;BR /&gt;    mssm.run(args)&lt;BR /&gt;    &lt;SPAN&gt;//LauncherMain.run(classOf[MyScalaShellMain], args)&lt;BR /&gt;&lt;/SPAN&gt;  }&lt;BR /&gt;&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;If I build this in the same jar and install it in both the /var/lib/oozie directory and the /lib directory next to my workflow.xml as a shared lib, I get a ClassNotFoundException, rethrown as a NoClassDefFoundError, pointing to indicated line in the custom action executor, but complaining about com/typesafe/scalalogging/Logging (is a static method invoking the constructor here?).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I tried to resolve the depenencies by including the following jars in the /var/lib/oozie directory and the lib directory next to my workflow.xml as a shared lib.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;scala-library-2.10.5.jar&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;scala-logging-slf4j_2.10-2.1.2.jar&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;scala-logging-api_2.10-2.1.2.jar&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;(The versions are selected to be compatible with the framework used for the production main).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fortunately the workflow runs with a successful completion status, jowever now the logging of the oozie workflow is no longer populated.&lt;/P&gt;&lt;P&gt;I think that is due to dependency conflicts, and am not sure how to correctly resolve them.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Sep 2022 09:30:51 GMT</pubDate>
    <dc:creator>BillM.</dc:creator>
    <dc:date>2022-09-16T09:30:51Z</dc:date>
    <item>
      <title>Cloudera 5.4.x oozie Custom Actions, how to use scala main classes?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Cloudera-5-4-x-oozie-Custom-Actions-how-to-use-scala-main/m-p/28248#M6179</link>
      <description>&lt;P&gt;Please forgive me if this appears twice, the forum claimed to discard my last message after successful preview and an attempt to post it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an oozie custom action on the Cloudera Quickstart 5.4.x VM, with an associated main class. &amp;nbsp;The main class is in scala (for intereoperability with a framework), and I'm having some challenges during testing. &amp;nbsp;Before going too deep into the details I would like to ask the following questions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;What is the recommended approach for the custom action executor to resolve the class name of the main class, particularly if the main class is written in scala?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;What is the automated and recommended way to determine what (if any) dependencies must be provided with (i) the custom action and (ii) the main class?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;What is the recommended way to package the dependencies (e.g. put extra jars in the directory, use a shadow/fat jar)?&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The details follow for a simplified sanitized version of what I'm dealing with that shows the salient features.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, let's consider the custom action executor, whch has the following structure, please note the labeled problematic line impacted at runtime by the presence/absence of dependencies.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;package &lt;/SPAN&gt;org.apache.oozie.action.hadoop&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;// all the imports are shown&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.apache.action.hadoop.MyScalaShellMain&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.apache.hadoop.conf.Configuration&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.apache.hadoop.fs.Path&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.apache.oozie.action.ActionExecutorException&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.jdom.Element&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.jdom.Namespace&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;java.util.List&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;public class &lt;/SPAN&gt;MyShellActionExecutor &lt;SPAN&gt;extends &lt;/SPAN&gt;JavaActionExecutor {&lt;BR /&gt;// stuff deleted&lt;BR /&gt;    &lt;SPAN&gt;@Override&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;protected &lt;/SPAN&gt;String &lt;SPAN&gt;getLauncherMain&lt;/SPAN&gt;(Configuration launcherConf&lt;SPAN&gt;, &lt;/SPAN&gt;Element actionXml) {&lt;BR /&gt;        &lt;SPAN&gt;final &lt;/SPAN&gt;String classNameToLaunch = MyScalaShellMain.&lt;SPAN&gt;class&lt;/SPAN&gt;.getName()&lt;SPAN&gt;; // This line fails without installing additional dependencies&lt;BR /&gt;&lt;/SPAN&gt;        &lt;SPAN&gt;LOG&lt;/SPAN&gt;.info(&lt;SPAN&gt;"getLauncherMain, classNameToLaunch = &lt;/SPAN&gt;&lt;SPAN&gt;\"&lt;/SPAN&gt;&lt;SPAN&gt;" &lt;/SPAN&gt;+ classNameToLaunch + &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;\"&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        return &lt;/SPAN&gt;launcherConf.get(LauncherMapper.&lt;SPAN&gt;CONF_OOZIE_ACTION_MAIN_CLASS&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;MyScalaShellMain.&lt;SPAN&gt;class&lt;/SPAN&gt;.getName())&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    }&lt;BR /&gt;&lt;BR /&gt;// more stuff deleted&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;The MyScalaShellMain class is a scala class with a companion object (to support the static main method), with the following structure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;package &lt;/SPAN&gt;org.apache.action.hadoop&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;java.io._&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;java.util&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;com.typesafe.scalalogging.Logging&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;com.typesafe.scalalogging.slf4j.Logger&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.slf4j.LoggerFactory&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;scala.collection.JavaConverters._&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.apache.hadoop.conf.Configuration&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.apache.hadoop.fs.Path&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.apache.hadoop.util.Shell&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;org.apache.oozie.action.hadoop._&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;com.typesafe.scalalogging&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;class &lt;/SPAN&gt;MyScalaShellMain &lt;SPAN&gt;extends &lt;/SPAN&gt;LauncherMain &lt;SPAN&gt;with &lt;/SPAN&gt;Logging {&lt;BR /&gt;  &lt;SPAN&gt;val &lt;/SPAN&gt;&lt;SPAN&gt;logger &lt;/SPAN&gt;= &lt;SPAN&gt;Logger&lt;/SPAN&gt;(LoggerFactory.&lt;SPAN&gt;getLogger&lt;/SPAN&gt;(getClass))&lt;BR /&gt;  &lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;  &lt;SPAN&gt;@throws&lt;/SPAN&gt;(classOf[Exception])&lt;BR /&gt;  &lt;SPAN&gt;protected def &lt;/SPAN&gt;&lt;SPAN&gt;run&lt;/SPAN&gt;(args: Array[&lt;SPAN&gt;String&lt;/SPAN&gt;]) {&lt;BR /&gt;    System.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;s"""run(args = &lt;/SPAN&gt;&lt;SPAN&gt;$&lt;/SPAN&gt;{args}&lt;SPAN&gt;) invoked"""&lt;/SPAN&gt;)&lt;BR /&gt;    &lt;SPAN&gt;val &lt;/SPAN&gt;actionConf: Configuration = loadActionConf&lt;BR /&gt;    System.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;"run, Before execute, actionConf = " &lt;/SPAN&gt;+ actionConf.toString)&lt;BR /&gt;    &lt;SPAN&gt;val &lt;/SPAN&gt;exitCode: &lt;SPAN&gt;Int &lt;/SPAN&gt;= execute(actionConf)&lt;BR /&gt;    System.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;"run After Execute, exitcode = "&lt;/SPAN&gt;)&lt;BR /&gt;    &lt;SPAN&gt;if &lt;/SPAN&gt;(exitCode != &lt;SPAN&gt;0&lt;/SPAN&gt;) {&lt;BR /&gt;      &lt;SPAN&gt;throw new &lt;/SPAN&gt;MyLauncherMainException(&lt;SPAN&gt;1&lt;/SPAN&gt;)&lt;BR /&gt;    }&lt;BR /&gt;  }&lt;BR /&gt;// stuff deleted&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/**&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt; * Companion object&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt; */&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;object &lt;/SPAN&gt;MyScalaShellMain{&lt;BR /&gt;  &lt;SPAN&gt;/**&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;   * &lt;/SPAN&gt;&lt;SPAN&gt;@param args &lt;/SPAN&gt;&lt;SPAN&gt;Invoked from LauncherMapper:map()&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;   * &lt;/SPAN&gt;&lt;SPAN&gt;@throws &lt;/SPAN&gt;&lt;SPAN&gt;Exception&lt;BR /&gt;&lt;/SPAN&gt;   &lt;SPAN&gt;*/&lt;BR /&gt;&lt;/SPAN&gt;  &lt;SPAN&gt;@throws&lt;/SPAN&gt;(classOf[Exception])&lt;BR /&gt;  &lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;main&lt;/SPAN&gt;(args: Array[&lt;SPAN&gt;String&lt;/SPAN&gt;]): &lt;SPAN&gt;Unit &lt;/SPAN&gt;= {&lt;BR /&gt;    System.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;"Starting main(args =  " &lt;/SPAN&gt;+ args + &lt;SPAN&gt;")"&lt;/SPAN&gt;)&lt;BR /&gt;    System.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;"The object's name is " &lt;/SPAN&gt;+ &lt;SPAN&gt;this&lt;/SPAN&gt;.getClass.getName)&lt;BR /&gt;    &lt;SPAN&gt;val &lt;/SPAN&gt;mssm = &lt;SPAN&gt;new &lt;/SPAN&gt;MyScalaShellMain&lt;BR /&gt;    mssm.run(args)&lt;BR /&gt;    &lt;SPAN&gt;//LauncherMain.run(classOf[MyScalaShellMain], args)&lt;BR /&gt;&lt;/SPAN&gt;  }&lt;BR /&gt;&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;If I build this in the same jar and install it in both the /var/lib/oozie directory and the /lib directory next to my workflow.xml as a shared lib, I get a ClassNotFoundException, rethrown as a NoClassDefFoundError, pointing to indicated line in the custom action executor, but complaining about com/typesafe/scalalogging/Logging (is a static method invoking the constructor here?).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I tried to resolve the depenencies by including the following jars in the /var/lib/oozie directory and the lib directory next to my workflow.xml as a shared lib.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;scala-library-2.10.5.jar&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;scala-logging-slf4j_2.10-2.1.2.jar&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;scala-logging-api_2.10-2.1.2.jar&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;(The versions are selected to be compatible with the framework used for the production main).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fortunately the workflow runs with a successful completion status, jowever now the logging of the oozie workflow is no longer populated.&lt;/P&gt;&lt;P&gt;I think that is due to dependency conflicts, and am not sure how to correctly resolve them.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 09:30:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Cloudera-5-4-x-oozie-Custom-Actions-how-to-use-scala-main/m-p/28248#M6179</guid>
      <dc:creator>BillM.</dc:creator>
      <dc:date>2022-09-16T09:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Cloudera 5.4.x oozie Custom Actions, how to use scala main classes?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Cloudera-5-4-x-oozie-Custom-Actions-how-to-use-scala-main/m-p/29340#M6180</link>
      <description>1. all classes related to the custom action would need to be in /var/lib/oozie 
2. all main and its dependencies would need to be in the sharelib [1] directory 

[1] &lt;A href="http://blog.cloudera.com/blog/2014/05/how-to-use-the-sharelib-in-apache-oozie-cdh-5/" target="_blank"&gt;http://blog.cloudera.com/blog/2014/05/how-to-use-the-sharelib-in-apache-oozie-cdh-5/&lt;/A&gt;</description>
      <pubDate>Tue, 07 Jul 2015 14:31:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Cloudera-5-4-x-oozie-Custom-Actions-how-to-use-scala-main/m-p/29340#M6180</guid>
      <dc:creator>Dat Pham</dc:creator>
      <dc:date>2015-07-07T14:31:53Z</dc:date>
    </item>
  </channel>
</rss>

