Support Questions

Find answers, ask questions, and share your expertise

Cloudera 5.4..x Oozie custom actions not finding LauncherMain derived classes

avatar
Explorer

I am testing in the Clouera Quickstart 5.4.x VM where I have a custom action which should launch a class dervied from LauncherMain, in the very same jar as the custom action nd in the same package that generates lass loading errors at run time in the logs.  How can I get my LauncherMain dervied class to resolve at runtime in Cloudear 5.4.x

 

2015-06-01 19:17:34,830 WARN org.apache.oozie.action.hadoop.MyShellActionExecutor: SERVER[quickstart.cloudera] USER[cloudera] GROUP[-] TOKEN[] APP[myshelltest-wf] JOB[0000001-150601185236348-oozie-oozi-W] ACTION[0000001-150601185236348-oozie-oozi-W@script-job] Launcher exception: java.lang.ClassNotFoundException: Class org.apache.oozie.action.hadoop.MyShellMain not found
java.lang.RuntimeException: java.lang.ClassNotFoundException: Class org.apache.oozie.action.hadoop.MyShellMain not found
	at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2112)
	at org.apache.oozie.action.hadoop.LauncherMapper.map(LauncherMapper.java:226)
	at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:54)
	at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:453)
	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:343)
	at org.apache.hadoop.mapred.LocalContainerLauncher$EventHandler.runSubtask(LocalContainerLauncher.java:370)
	at org.apache.hadoop.mapred.LocalContainerLauncher$EventHandler.runTask(LocalContainerLauncher.java:295)
	at org.apache.hadoop.mapred.LocalContainerLauncher$EventHandler.access$200(LocalContainerLauncher.java:181)
	at org.apache.hadoop.mapred.LocalContainerLauncher$EventHandler$1.run(LocalContainerLauncher.java:224)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: Class org.apache.oozie.action.hadoop.MyShellMain not found
	at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2018)
	at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2110)
	... 13 more

 

Consider the following example, the code for the custom action reads:

 

package org.apache.oozie.action.hadoop; // So that we can leverage the JavaActionExecutor

public class MyShellActionExecutor extends JavaActionExecutor {

// most code omitted for brevity /L

 

@Override
protected String getLauncherMain(Configuration launcherConf, Element actionXml) {
return launcherConf.get(LauncherMapper.CONF_OOZIE_ACTION_MAIN_CLASS, MyShellMain.class.getName());
}

 

}

 

and MyShellMain includes the following (a lot of code is omitted for brevity):

 

package org.apache.oozie.action.hadoop;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.util.Shell;

import java.io.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;

/**
* Created by BillM on 6/1/15.
*/
public class MyShellMain extends LauncherMain {

/**
* @param args Invoked from LauncherMapper:map()
* @throws Exception
*/
public static void main(String[] args) throws Exception {
run(ShellMain.class, args);
}

 

// stuff omitted

 

}

:

 

 

 

1 ACCEPTED SOLUTION

avatar
Contributor
- the custom action jar would need to be on the Oozie server hence it needs to go into /var/lib/oozie directory. - main class needs be in the sharelib http://blog.cloudera.com/blog/2012/12/how-to-use-the-sharelib-in-apache-oozie/ http://blog.cloudera.com/blog/2014/05/how-to-use-the-sharelib-in-apache-oozie-cdh-5/

View solution in original post

2 REPLIES 2

avatar
Contributor
- the custom action jar would need to be on the Oozie server hence it needs to go into /var/lib/oozie directory. - main class needs be in the sharelib http://blog.cloudera.com/blog/2012/12/how-to-use-the-sharelib-in-apache-oozie/ http://blog.cloudera.com/blog/2014/05/how-to-use-the-sharelib-in-apache-oozie-cdh-5/

avatar
Explorer

Thanks for the reminder/hint, it got me past that issue.

 

Bill M.