Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Oozie Java Action - Hbase : Error

avatar
Contributor

I'm running a test hbase java program via oozie java action. The following error is encountered :

Error, 
java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration
	at org.apache.oozie.action.hadoop.HbaseCredentials.copyHbaseConfToJobConf(HbaseCredentials.java:67)
	at org.apache.oozie.action.hadoop.HbaseCredentials.addtoJobConf(HbaseCredentials.java:55)
	at org.apache.oozie.action.hadoop.JavaActionExecutor.setCredentialTokens(JavaActionExecutor.java:1287)
	at org.apache.oozie.action.hadoop.JavaActionExecutor.submitLauncher(JavaActionExecutor.java:1124)
	at org.apache.oozie.action.hadoop.JavaActionExecutor.start(JavaActionExecutor.java:1373)
	at org.apache.oozie.command.wf.ActionStartXCommand.execute(ActionStartXCommand.java:232)
	at org.apache.oozie.command.wf.ActionStartXCommand.execute(ActionStartXCommand.java:63)
	at org.apache.oozie.command.XCommand.call(XCommand.java:287)
	at org.apache.oozie.service.CallableQueueService$CompositeCallable.call(CallableQueueService.java:331)
	at org.apache.oozie.service.CallableQueueService$CompositeCallable.call(CallableQueueService.java:260)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.apache.oozie.service.CallableQueueService$CallableWrapper.run(CallableQueueService.java:178)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)




	at java.lang.Thread.run(Thread.java:745)

The program runs correctly from command line :

java -cp `hbase classpath` personal_project.HBaseConnector

Is there a way I can pass output of 'hbase classpath' to the oozie java action. I have copied below hbase jars to workflow's lib directory as well.

  • hbase-common-$HBASE_VERSION.jar
  • hbase-client-$HBASE_VERSION.jar
  • hbase-server-$HBASE_VERSION.jar
  • hbase-protocol-$HBASE_VERSION.jar
  • hbase-hadoop2-compat-$HBASE_VERSION.jar
  • htrace-core-*.jar
  • hive-hbase-handler-$HBASE_VERSION.jar

Following is the java action from workflow.xml :

<workflow-app xmlns="uri:oozie:workflow:0.5" name="hbase_connect">
	<global>
		<job-tracker>${job_tracker}</job-tracker>
		<name-node>${name_node}</name-node>
	</global>
	<credentials>
		<credential name="hbase-cred" type="hbase">
			<property>
				<name>hadoop.security.authentication</name>
				<value>kerberos</value>
			</property>
			<property>
				<name>hbase.security.authentication</name>
				<value>kerberos</value>
			</property>
			<property>
				<name>hbase.master.kerberos.principal</name>
				<value>hbase/_HOST@XX.XX.COM</value>
			</property>
			<property>
				<name>hbase.regionserver.kerberos.principal</name>
				<value>hbase/_HOST@XX.XX.COM</value>
			</property>
			<property>
				<name>hbase.zookeeper.quorum</name>
				<value>${zookeeper_quorum}</value>
			</property>
			<property>
				<name>hadoop.rpc.protection</name>
				<value>authentication</value>
			</property>
			<property>
				<name>hbase.rpc.protection</name>
				<value>authentication</value>
			</property>
		</credential>
	</credentials>
	
	<start to="hbase_connect_java" />
	<action name="hbase_connect_java" cred="hbase-cred">
		<java>
                        <job-xml>${runconfig_dir}/hbase-site.xml</job-xml>
			<main-class>personal_project.HBaseConnector</main-class>
			<java-opts>-Dsun.security.krb5.debug=true</java-opts>
			<arg>${name_node}</arg>
			<arg>${kerberos_principal}</arg>
			<arg>${kerberos_keytab_file}</arg>
			<arg>a:xxx,b:yyy,c:zzz,d:yyy</arg>
			<arg>2016-02-22-123456</arg>
			<file>${path_hdfs_common}/lib/hbase_connect.jar#hbase_connect.jar</file>
			<file>${runconfig_dir}/jaas.conf#jaas.conf</file>
			<file>${runconfig_dir}/krb5.conf#krb5.conf</file>
                        <file>${runconfig_dir}/hbase-site.xml#hbase-site.xml</file>
		</java>
		<ok to="end"/>
		<error to="fail"/>
	</action>
	<kill name="fail">
		<message>${wf:name()}  workflow failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
	</kill>
	<end name="end"/>
</workflow-app>
1 ACCEPTED SOLUTION

avatar
Contributor

Adding the below Credential properties fixed my issue.

<credentials>
		<credential name="hbase-cred" type="hbase">
			<property>
				<name>hadoop.security.authentication</name>
				<value>kerberos</value>
			</property>
			<property>
				<name>hbase.security.authentication</name>
				<value>kerberos</value>
			</property>
			<property>
				<name>hbase.master.kerberos.principal</name>
				<value>hbase/_HOST@XX.XX.COM</value>
			</property>
			<property>
				<name>hbase.regionserver.kerberos.principal</name>
				<value>hbase/_HOST@XX.XX.COM</value>
			</property>
			<property>
				<name>hbase.zookeeper.quorum</name>
				<value>${zookeeper_quorum}</value>
			</property>
			<property>
				<name>hadoop.rpc.protection</name>
				<value>authentication</value>
			</property>
			<property>
				<name>hbase.rpc.protection</name>
				<value>authentication</value>
			</property>
			<property>
				<name>hbase.master.keytab.file</name>
				<value>/etc/hadoop/hbase.keytab</value>
			</property>
			<property>
				<name>hbase.regionserver.keytab.file</name>
				<value>/etc/hadoop/hbase.keytab</value>
			</property>
		</credential>
	</credentials>

View solution in original post

3 REPLIES 3

avatar
Expert Contributor

@Padmanabhan Vijendran Check if ozzie shared lib is configured properly and has right hbase dependencies. If not properly configured you can recreate shared lib using below commands:

/usr/hdp/current/oozie/bin/oozie-setup.sh sharelib create -locallib /usr/hdp/<version>/oozie/oozie-sharelib.tar.gz -fs hdfs://<namenode-host>:8020
oozie admin -oozie http://<oozie-host>:11000/oozie -sharelibupdate

avatar
Contributor

@Ajay I am not an admin to do this. I believe sharelib is properly set. Hive Actions are running fine.

avatar
Contributor

Adding the below Credential properties fixed my issue.

<credentials>
		<credential name="hbase-cred" type="hbase">
			<property>
				<name>hadoop.security.authentication</name>
				<value>kerberos</value>
			</property>
			<property>
				<name>hbase.security.authentication</name>
				<value>kerberos</value>
			</property>
			<property>
				<name>hbase.master.kerberos.principal</name>
				<value>hbase/_HOST@XX.XX.COM</value>
			</property>
			<property>
				<name>hbase.regionserver.kerberos.principal</name>
				<value>hbase/_HOST@XX.XX.COM</value>
			</property>
			<property>
				<name>hbase.zookeeper.quorum</name>
				<value>${zookeeper_quorum}</value>
			</property>
			<property>
				<name>hadoop.rpc.protection</name>
				<value>authentication</value>
			</property>
			<property>
				<name>hbase.rpc.protection</name>
				<value>authentication</value>
			</property>
			<property>
				<name>hbase.master.keytab.file</name>
				<value>/etc/hadoop/hbase.keytab</value>
			</property>
			<property>
				<name>hbase.regionserver.keytab.file</name>
				<value>/etc/hadoop/hbase.keytab</value>
			</property>
		</credential>
	</credentials>