I am starting the HiveThriftServer in Spark application by using : HiveThriftServer2 .startWithContext(session.sqlContext());
I can see that i need to include hive-jdbc-1.2.1.spark2, hive-exec-1.2.1.spark2, hive-metastore-1.2.1.spark2 jars in the classpath to start it.
So far so good, it starts and i can see the "JDBC/ODBC" tab in Spark UI.
Now, in the client side (where i need to connect to this server to access the data), i have more advanced version of JARS like hive-jdbc-2.1.1 etc. When i try to connect to the server with below code, i get an exception:
try {
Class.forName("org.apache.hive.jdbc.HiveDriver");
} catch (ClassNotFoundException e) {
System.out.println("Driver not found");
}
Connection con = DriverManager.getConnection("jdbc:hive2://<server-name>:10015/default", "", "");
Exception: Caused by: org.apache.thrift.TApplicationException: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null, configuration:{use:database=default}) at org.apache.thrift.TApplicationException.read(TApplicationException.java:111) at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:79) at org.apache.hive.service.rpc.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:168) at org.apache.hive.service.rpc.thrift.TCLIService$Client.OpenSession(TCLIService.java:155) at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:576)
And if i use the same version of JARS as server, its working.
Now i have two options: 1. Change JARS on server side to newer versions (2.1.1) , but then the server doesn't start(actually it complains for ClassNotFound issues). The HiveThriftServer2 class comes from spark-hive-thriftserver jar and if i look at its pom.xml, it has dependency of 1.2.1 jars , and that makes it obvious that server won't start on 2.1.1 versions
- I change the version on client side, But i don't have the option of changing the JAR version, as other applications in the App server are dependent on those versions.
Can anyone suggest any possible way to fix this? (Ideally the newer versions of jas should have backward compatibility)