简体   繁体   English

通过JDBC连接到Hive时出现Java NoSuchMethodError

[英]Java NoSuchMethodError when connecting via JDBC to Hive

I'm getting the following error when attempting to connect to Hive from a simple java program in Eclipse. 尝试从Eclipse中的简单Java程序连接到Hive时出现以下错误。 It looks like it connects then throws this error. 看起来好像连接,然后引发此错误。 I can connect to Hive Thrift server locally through beeline without issues. 我可以通过beeline在本地连接到Hive Thrift服务器,而不会出现问题。

both libthrift .jar files are 0.9.2. 两个libthrift .jar文件均为0.9.2。 Same on client and server. 在客户端和服务器上相同。 Version for server and client for the following .jar files are the same: 以下.jar文件的服务器和客户端版本相同:

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. 我使用的libthrift版本被Apache列为具有getScheme()方法。

Any help would be greatly appreciated! 任何帮助将不胜感激!

Make sure you have included the required jar files on your classpath. 确保已在类路径中包括了所需的jar文件。 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. 如果它在实际服务器上不起作用,请确保已部署所需的jar。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM