Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

FAILED: SemanticException [Error 10072]: Database does not exist: testnamespace -- Oozie

avatar
Expert Contributor

I get an error while running an Oozie workflow with Hive queries.

Here is the workflow

<workflow-app xmlns='uri:oozie:workflow:0.5' name='reporting_W_errorAuditHiveQueryExe'>
	<start to="hive_report_fork"/>
	<fork name="hive_report_fork">
		<path start="hiveGSRLfile"/>
		<path start="hiveNGSRLfile"/>
		<path start="hiveNGsrlRAfile"/>
	</fork>
	<action name="hiveGSRLfile">
		<hive xmlns='uri:oozie:hive-action:0.2'>
			<job-tracker>${jobTracker}</job-tracker>
			<name-node>${nameNode}</name-node>
			<script>${dir}/gsrlQery.hql</script>
			<param>OutputDir=${jobOutput}</param>
		</hive>
		<ok to="joining"/>
		<error to="joining"/>
	</action>
	<action name="hiveNGSRLfile">
		<hive xmlns='uri:oozie:hive-action:0.2'>
			<job-tracker>${jobTracker}</job-tracker>
			<name-node>${nameNode}</name-node>
			<script>${dir}/nongsrlQuery.hql</script>
			<param>OutputDir=${jobOutput}</param>
		</hive>
		<ok to="joining"/>
		<error to="joining"/>
	</action>
	<action name="hiveNGsrlRAfile">
		<hive xmlns='uri:oozie:hive-action:0.2'>
			<job-tracker>${jobTracker}</job-tracker>
			<name-node>${nameNode}</name-node>
			<script>${dir}/nongsrlRAQuery.hql</script>
			<param>OutputDir=${jobOutput}</param>
		</hive>
		<ok to="joining"/>
		<error to="joining"/>
	</action>
	<join name= "joining" to="Success"/>
	<action name="Success">
		<email xmlns="uri:oozie:email-action:0.1">
			<to>${failureEmailToAddress}</to>
			<subject>Success</subject>
			<body>
				The workflow ${wf:name()} with id ${wf:id()} failed
				[${wf:errorMessage(wf:lastErrorNode())}].
			</body>
		</email>
		<ok to="end" />
		<error to="fail" />
	</action>
	<action name="failure">
		<email xmlns="uri:oozie:email-action:0.1">
			<to>${failureEmailToAddress}</to>
			<subject>Failure</subject>
			<body>
				The workflow ${wf:name()} with id ${wf:id()} failed
				[${wf:errorMessage(wf:lastErrorNode())}].
			</body>
		</email>
		<ok to="end" />
		<error to="fail" />
	</action>
	<kill name="fail">
		<message>Workflow failed</message>
	</kill>
	<end name="end"/>
</workflow-app>

And here is the oozie properties file

oozie.wf.application.path=${deploymentPath}/workflows/errorAuditHiveQueryExe.xml
deploymentPath=/user/amin/deploy_178
jobTracker=localhost:8032
nameNode=hdfs://nameservice1
dir=${deploymentPath}/data-warehouse/temp
failureEmailToAddress=amin@dnb.com
jobOutput=${dir}
oozie.use.system.libpath=true

Here is the error I get:

FAILED: SemanticException [Error 10072]: Database does not exist: testnamespace 
Intercepting System.exit(10072)
Failing Oozie Launcher, Main class [org.apache.oozie.action.hadoop.HiveMain], exit code [10072]

However the namespace exist and I can query the tables inside it.

What could be wrong here? Please help.

1 ACCEPTED SOLUTION

avatar
Expert Contributor

After a tireless research on the internet I was able to crack the solution for the issue. I have added a configuration to use the metastore server for the Hive job and it worked. Here is what I did to the Hive action.

....
    <hive xmlns='uri:oozie:hive-action:0.2'>
    <job-tracker>${jobTracker}</job-tracker>
    <name-node>${nameNode}</name-node>
    <configuration>
                    <property>
                     <name>hive.metastore.uris</name>
     <value>thrift://10.155.1.63:9083</value>
                    </property>
                </configuration>
    <script>${dir}/gsrlQery.hql</script>
    <param>OutputDir=${jobOutput}</param>
    </hive>
    .... 

Note: replace the hive metatore ip accordingly if you are trying to fix a similar problem. To get the metastore details check the hive-site.xml file located in /etc/hive/conf dir.

Credit: MapR

View solution in original post

1 REPLY 1

avatar
Expert Contributor

After a tireless research on the internet I was able to crack the solution for the issue. I have added a configuration to use the metastore server for the Hive job and it worked. Here is what I did to the Hive action.

....
    <hive xmlns='uri:oozie:hive-action:0.2'>
    <job-tracker>${jobTracker}</job-tracker>
    <name-node>${nameNode}</name-node>
    <configuration>
                    <property>
                     <name>hive.metastore.uris</name>
     <value>thrift://10.155.1.63:9083</value>
                    </property>
                </configuration>
    <script>${dir}/gsrlQery.hql</script>
    <param>OutputDir=${jobOutput}</param>
    </hive>
    .... 

Note: replace the hive metatore ip accordingly if you are trying to fix a similar problem. To get the metastore details check the hive-site.xml file located in /etc/hive/conf dir.

Credit: MapR