diff --git hcatalog/bin/templeton.cmd hcatalog/bin/templeton.cmd index dcb976e..8ec3b4b 100644 --- hcatalog/bin/templeton.cmd +++ hcatalog/bin/templeton.cmd @@ -22,23 +22,26 @@ setlocal enabledelayedexpansion if "%1" == "--service" ( set service_entry=true shift + set templeton-service-name=%1 + if not defined templeton-service-name ( + goto print_usage + ) ) @rem Init hadoop env variables (CLASSPATH, HADOOP_OPTS, etc) + @rem deal with difference in the location of hadoop-config.cmd set HADOOP_OPTS= - call %HADOOP_HOME%\bin\hadoop-config.cmd - - set templeton-service-name=%1 - - if not defined templeton-service-name ( - goto print_usage + if exist %HADOOP_HOME%\libexec\hadoop-config.cmd ( + call %HADOOP_HOME%\libexec\hadoop-config.cmd + ) else ( + call %HADOOP_HOME%\bin\hadoop-config.cmd ) @rem @rem Compute the classpath @rem - set TEMPLETON_CONF_DIR=%HCATALOG_HOME%\conf - set TEMPLETON_CLASSPATH=%TEMPLETON_CONF_DIR%;%HCATALOG_HOME%;%HCATALOG_HOME%\share\webhcat\svr + set WEBHCAT_CONF_DIR=%HCATALOG_HOME%\etc\webhcat + set TEMPLETON_CLASSPATH=%WEBHCAT_CONF_DIR%;%HCATALOG_HOME%;%HCATALOG_HOME%\share\webhcat\svr set TEMPLETON_CLASSPATH=!TEMPLETON_CLASSPATH!;%HCATALOG_HOME%\share\hcatalog\* set TEMPLETON_CLASSPATH=!TEMPLETON_CLASSPATH!;%HCATALOG_HOME%\share\webhcat\svr\* @@ -55,7 +58,7 @@ setlocal enabledelayedexpansion if not defined TEMPLETON_LOG4J ( @rem must be prefixed with file: otherwise config is not picked up - set TEMPLETON_LOG4J=file:%HCATALOG_HOME%\conf\webhcat-log4j.properties + set TEMPLETON_LOG4J=file:%WEBHCAT_CONF_DIR%\webhcat-log4j.properties ) set TEMPLETON_OPTS=-Dtempleton.log.dir=%TEMPLETON_LOG_DIR% -Dlog4j.configuration=%TEMPLETON_LOG4J% %HADOOP_OPTS% set arguments=%JAVA_HEAP_MAX% %TEMPLETON_OPTS% -classpath %CLASSPATH% org.apache.hcatalog.templeton.Main @@ -63,7 +66,7 @@ setlocal enabledelayedexpansion if defined service_entry ( call :makeServiceXml %arguments% ) else ( - goto print_usage + call %JAVA% %arguments% ) goto :eof diff --git hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/TrivialExecService.java hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/TrivialExecService.java index 73892cc..a2038ec 100644 --- hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/TrivialExecService.java +++ hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/TrivialExecService.java @@ -20,6 +20,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.fs.Path; import java.io.File; import java.io.IOException; @@ -65,7 +66,7 @@ private static void hadoop2LogRedirect(ProcessBuilder processBuilder) { //TempletonControllerJob ensures that this file is in DistributedCache File log4jProps = new File(JobSubmissionConstants.CONTAINER_LOG4J_PROPS); hcopts = hcopts.replace("log4j.configuration=container-log4j.properties", - "log4j.configuration=file://" + log4jProps.getAbsolutePath()); + "log4j.configuration=file://" + new Path(log4jProps.getAbsolutePath()).toUri().toString()); //helps figure out what log4j is doing, but may confuse //some jobs due to extra output to stdout //hcopts = hcopts + " -Dlog4j.debug=true";