HDFS-11333. Print a user friendly error message when plugins are not found. Contributed by Wei-Chiu Chuang.

(cherry picked from commit 859bd159ae)
This commit is contained in:
Wei-Chiu Chuang 2017-02-15 02:50:35 -08:00
parent 9cab25a63d
commit a8531d5d52
2 changed files with 18 additions and 3 deletions

View File

@ -928,7 +928,15 @@ public class DataNode extends ReconfigurableBase
} }
private void startPlugins(Configuration conf) { private void startPlugins(Configuration conf) {
plugins = conf.getInstances(DFS_DATANODE_PLUGINS_KEY, ServicePlugin.class); try {
plugins = conf.getInstances(DFS_DATANODE_PLUGINS_KEY,
ServicePlugin.class);
} catch (RuntimeException e) {
String pluginsValue = conf.get(DFS_DATANODE_PLUGINS_KEY);
LOG.error("Unable to load DataNode plugins. Specified list of plugins: " +
pluginsValue, e);
throw e;
}
for (ServicePlugin p: plugins) { for (ServicePlugin p: plugins) {
try { try {
p.start(this); p.start(this);

View File

@ -810,8 +810,15 @@ public class NameNode extends ReconfigurableBase implements
httpServer.setFSImage(getFSImage()); httpServer.setFSImage(getFSImage());
} }
rpcServer.start(); rpcServer.start();
try {
plugins = conf.getInstances(DFS_NAMENODE_PLUGINS_KEY, plugins = conf.getInstances(DFS_NAMENODE_PLUGINS_KEY,
ServicePlugin.class); ServicePlugin.class);
} catch (RuntimeException e) {
String pluginsValue = conf.get(DFS_NAMENODE_PLUGINS_KEY);
LOG.error("Unable to load NameNode plugins. Specified list of plugins: " +
pluginsValue, e);
throw e;
}
for (ServicePlugin p: plugins) { for (ServicePlugin p: plugins) {
try { try {
p.start(this); p.start(this);