Error while executing program with Hive JDBC

前端 未结 2 893
悲哀的现实
悲哀的现实 2021-01-20 22:40

I have written this small program for Hive JDBC. Initially it is executing fine but when I tried to run now suddenly I got error.

Program:

import j         


        
相关标签:
2条回答
  • 2021-01-20 22:55

    I faced the same error when I was trying run a sample JDBC against HIVE. I then added the location of libfb*.jar to the classpath & it worked fine for me. What I've learnt from the JDBC execution is that it requires a whole load of jar files which need to be explicitly mentioned in the classpath. My classpath looked something like this (the last few jars are absolutely required for the JDBC to execute)

    [cloudera@quickstart ownjava]$ echo $CLASSPATH
    /etc/hadoop/conf:/usr/lib/hadoop/lib/*:/usr/lib/hadoop/.//*:/usr/lib/hadoop-hdfs/./:/usr/lib/hadoop-hdfs/lib/*:/usr/lib/hadoop-hdfs/.//*:/usr/lib/hadoop-yarn/lib/*:/usr/lib/hadoop-yarn/.//*:/usr/lib/hadoop-mapreduce/lib/*:/usr/lib/hadoop-mapreduce/.//*:/usr/lib/hive/lib/:/usr/lib/hive/lib/hive-exec.jar:/usr/lib/hive/lib/hive-exec-0.12.0-cdh5.1.0.jar:/usr/lib/hive/lib/hive-service.jar:/usr/lib/hive/lib/hive-service-0.12.0-cdh5.1.0.jar:/usr/lib/hive/lib/hive-metastore.jar:/usr/lib/hive/lib/hive-metastore-0.12.0-cdh5.1.0.jar:/home/cloudera/ownjava/:/usr/lib/hive/lib/hive-jdbc-0.12.0-cdh5.1.0.jar:/usr/lib/hive/lib/hive-jdbc.jar:/usr/lib/hive/lib/libfb303-0.9.0.jar:/usr/lib/hive/lib/jdo-api-3.0.1.jar:/usr/lib/hive/lib/antlr-runtime-3.4.jar
    
    0 讨论(0)
  • 2021-01-20 22:58

    By any chance do you have more than different versions of thrift and libthrift hanging around? It sounds like the classes are being generated with one version of thrift, but trying to use a different version of libthrift at runtime.

    0 讨论(0)
提交回复
热议问题