Skip to content

Commit 1b39d51

Browse files
author
dapeng
committed
valid keytab exist
1 parent 37d2588 commit 1b39d51

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

hbase/hbase-sink/src/main/java/com/dtstack/flink/sql/sink/hbase/HbaseConfigUtils.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
package com.dtstack.flink.sql.sink.hbase;
2020

2121
import org.apache.hadoop.conf.Configuration;
22+
import org.apache.hadoop.hbase.exceptions.IllegalArgumentIOException;
2223
import org.apache.hadoop.security.UserGroupInformation;
2324
import org.slf4j.Logger;
2425
import org.slf4j.LoggerFactory;
2526

27+
import java.io.File;
2628
import java.io.IOException;
2729

2830
/**
@@ -69,6 +71,10 @@ public static UserGroupInformation loginAndReturnUGI(Configuration conf, String
6971
throw new IllegalArgumentException("keytab can not be null");
7072
}
7173

74+
if (!new File(keytab).exists()){
75+
throw new IllegalArgumentIOException("keytab ["+ keytab + "] not exist");
76+
}
77+
7278
conf.set("hadoop.security.authentication", "Kerberos");
7379
UserGroupInformation.setConfiguration(conf);
7480

0 commit comments

Comments
 (0)