0

I'm getting the following error when attempting to connect to Hive from a simple java program in Eclipse. It looks like it connects then throws this error. I can connect to Hive Thrift server locally through beeline without issues.

both libthrift .jar files are 0.9.2. Same on client and server. Version for server and client for the following .jar files are the same:

hive-jdbc*.jar              1.2.0
hive-service*.jar           1.2.0
libfb303-0.9.0.jar          0.9.2
libthrift-0.9.0.jar         0.9.2
log4j-1.2.16.jar            1.2.16
slf4j-api-1.6.1.jar         1.7.5
slf4j-log4j12-1.6.1.jar     1.7.5
commons-logging-1.0.4.jar   1.1.3


Exception in thread "main" java.lang.NoSuchMethodError: org.apache.thrift.protocol.TProtocol.getScheme()Ljava/lang/Class;
       at org.apache.hive.service.cli.thrift.TCLIService$OpenSession_args.write(TCLIService.java:1854)
       at org.apache.thrift.TServiceClient.sendBase(TServiceClient.java:63)
       at org.apache.hive.service.cli.thrift.TCLIService$Client.send_OpenSession(TCLIService.java:150)
       at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:142)
       at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:578)
       at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:192)
       at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
       at java.sql.DriverManager.getConnection(Unknown Source)
       at java.sql.DriverManager.getConnection(Unknown Source)

The libthrift version I am using is listed by Apache as having the getScheme() method.

Any help would be greatly appreciated!

JonathanS
  • 75
  • 2
  • 7

1 Answers1

0

Make sure you have included the required jar files on your classpath. As you said its working on your local then I guess you did. If its not working on the actual server then make sure you have deployed the required jars.

NilZzz
  • 26
  • 3
  • Do you mean the java classpath or Hive classpath? The .jar files are in the HIVE/lib directory. I also have a $JAVA_HOME environment variable set to the system java install. – JonathanS Jun 15 '15 at 19:59
  • Try adding it in your java classpath. You can do that by going to the project properties and then Java Build Path, then Add External Jars. http://stackoverflow.com/questions/11463354/how-to-put-a-jar-in-classpath-in-eclipse – NilZzz Jun 15 '15 at 21:52