// make sure that the base scratch directories exists and writable
setupStagingDir(hiveConf.getVar(HiveConf.ConfVars.SCRATCHDIR), false);
setupStagingDir(hiveConf.getVar(HiveConf.ConfVars.LOCALSCRATCHDIR), true);
setupStagingDir(hiveConf.getVar(HiveConf.ConfVars.DOWNLOADED_RESOURCES_DIR), true);
} catch (IOException eIO) {
throw new ServiceException("Error setting stage directories", eIO);
}
try {
// Initialize and test a connection to the metastore
metastoreClient = new HiveMetaStoreClient(hiveConf);
metastoreClient.getDatabases("default");
} catch (Exception e) {
throw new ServiceException("Unable to connect to MetaStore!", e);
}
}