我正在尝试使用jdbc测试与hive2的连接 . 但我得到一个身份验证失败的错误,其中凭据是正确的 .

我得到的错误是:

java -cp . :/ users / apps / ewbeiu / wbeeappp / HiveJdbcClient / * HiveJdbcClient SLF4J:无法加载类“org.slf4j.impl.StaticLoggerBinder” . SLF4J:默认为无操作(NOP) Logger 实现SLF4J:有关更多详细信息,请参阅http://www.slf4j.org/codes.html#StaticLoggerBinder . 无法连接到数据库请检查您的设置java.sql.SQLException:无法打开与jdbc的连接:hive2://edbd.corp.com:10000 / wbe:对等指示失败:错误验证登录线程中的异常“main “HiveJdbcClient.main上的HiveJdbcClient.executeQuery(HiveJdbcClient.java:49)中的java.lang.NullPointerException(HiveJdbcClient.java:58)

完整的代码为Folllows

import java.sql.*;
import java.text.ParseException;

public class HiveJdbcClient {
    private static final String DRIVER_NAME = "org.apache.hive.jdbc.HiveDriver";
    private static final String HIVE_URL = "jdbc:hive2://edabd.xyz.com:10000/wbe";
    private static final String HIVE_UNAME = "xyz";
    private static final String HIVE_PWD = "Pec7";
    private static Connection con;

    private HiveJdbcClient() {
    }

    public static Connection getConnection() {
            try {
                    if (con == null) {
                            synchronized (HiveJdbcClient.class) {
                                    if (con == null) {
                                            Class.forName(DRIVER_NAME);
                                            con = DriverManager.getConnection(HIVE_URL, HIVE_UNAME,
                                                            HIVE_PWD);
                                            System.out
                                                            .println("Successfuly Connected to database...!");
                                    }
                            }// End of synchronized block.
                    }// End of if block.
            } catch (SQLException e) {
                    System.out
                                    .println("Not able to connect to database pls check your settings \n"
                                                    + e);
            } catch (ClassNotFoundException e) {
                    System.out
                                    .println("Not able to connect to database pls check your settings \n"
                                                    + e);
            }// End of try-catch block.
            return con;
    }// End of getConnection() Method.

    public static ResultSet executeQuery(String sql) {
            ResultSet set = null;
            try {
                    if (sql != null) {
                            set = getConnection().createStatement().executeQuery(sql);
                    }
            } catch (SQLException e) {
                    System.out.println("Error while executing query " + e);
            }// End of try-catch block.
            return set;
    }// End of executeQuery() Method.

    public static void main(String[] args) throws ParseException, SQLException {
            ResultSet res = executeQuery("show tables;");
            while (res.next()) {
                    System.out.println(String.valueOf(res.getString(1))
                            //      + String.valueOf(res.getFloat(2)) + '\t'
                            //      + String.valueOf(res.getString(3))
                            );
            }

    }
}


> The drivers in the classpath are as follows:
> 
> httpclient-4.2.5.jar commons-codec-1.4.jar httpcore-4.2.5.jar
> commons-logging-1.1.3.jar libthrift-0.9.0.jar
> hive-common-0.13.0.2.1.2.0-402.jar hive-service-0.13.0.2.1.2.0-402.jar
> hive-jdbc-0.13.0.2.1.2.0-402.jar hadoop-common-2.4.0.2.1.2.0-402.jar
> slf4j-api-1.7.5.jar guava-11.0.2.jar