i am trying to connect to bigdata using JDBC hive with password less trusted authentication and here is my code
String conStr = "jdbc:hive2://bigdataplatform.abc.com:10000/staging;principal=hive/bigdataplatform.abc.com@BIGIP.abc.com;ssl=true";
Class.forName("org.apache.hive.jdbc.HiveDriver");
con = DriverManager.getConnection(conStr, "my_fid", "");
Statement stmt = con.createStatement();
stmt.executeQuery("show databases");
System.out.println("show database successfully.");
And below are the dependencies i added
hive-jdbc-3.1.3.jar
hive-service-rpc-3.1.3.jar
jdk.tools-1.8.0_321.jar
libthrift-0.9.3.jar
slf4j-api-2.0.11.jar
hive-service-3.1.3.jar
curator-client-2.12.0.jar
hive-exec-3.1.3.jar
hadoop-common-3.1.0.jar
commons-configuration2-2.1.1.jar
hadoop-auth-3.1.0.jar
woodstox-core-5.0.3.jar
stax2-api-3.1.4.jar
commons-collections-3.2.2.jar
Below is krb5.conf file realm entries
[realms]
BIGIP.abc.com = {
kdc = xxx.abc.com:88
admin_server = ****
kpasswd_server = *****
master_kdc = ***
}
i packed it as jar and when i execute it from the RHEL8 server using below command
${JAVA_HOME}/bin/java -jar -Xms4000m /tmp/Hive_Test.jar com.data.TestMain
Below is the error i get, what it means, do i need to update krb5.conf file?
Caused by: java.lang.IllegalAccessException: class org.apache.hadoop.security.authentication.util.KerberosUtil cannot access class sun.security.krb5.Config (in module java.security.jgss) because module java.security.jgss does not export sun.security.krb5 to unnamed module @571613d2
This problem arises because access to JDK-internal APIs is restricted to encourage the use of standard APIs and to maintain the integrity of the module system.
Try
${JAVA_HOME}/bin/java --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED -Xms4000m -jar /tmp/Hive_Test.jar com.data.TestMain