HIVE无法正常启动,报找不到jdbc的驱动类

通过启动脚本:

cd $HIVE_HOME

./bin/hive  --hiveconf hive.root.logger=DEBUG,console

启动报如下错误:

16/08/25 19:06:18 [main]: DEBUG bonecp.BoneCPDataSource: JDBC URL = 

        jdbc:mysql://slave1:3306/hive?createDatabaseIfNotExist=true

, Username = hive, partitions = 1, max (per partition) = 10, min (per partition) = 0, idle max age = 60 min, idle test period = 240 min, strategy = DEFAULT

16/08/25 19:06:19 [BoneCP-pool-watch-thread]: ERROR bonecp.BoneCP: Failed to acquire connection to 

        jdbc:mysql://slave1:3306/hive?createDatabaseIfNotExist=true

. Sleeping for 7000 ms. Attempts left: 5

java.sql.SQLException: No suitable driver found for 

        jdbc:mysql://slave1:3306/hive?createDatabaseIfNotExist=true


        at java.sql.DriverManager.getConnection(DriverManager.java:689)

        at java.sql.DriverManager.getConnection(DriverManager.java:208)

        at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:361)

        at com.jolbox.bonecp.BoneCP.obtainInternalConnection(BoneCP.java:269)

        at com.jolbox.bonecp.ConnectionHandle.<init>(ConnectionHandle.java:242)

        at com.jolbox.bonecp.PoolWatchThread.fillConnections(PoolWatchThread.java:115)

        at com.jolbox.bonecp.PoolWatchThread.run(PoolWatchThread.java:82)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

        at java.lang.Thread.run(Thread.java:745)


这是报没有找到连接mysql的jdbc驱动,但是实际上$HIVE_HOME/lib下已经有mysql的驱动包了

[hadoop@master lib]$ ll mysql-connector-java-5.1.33.jar
-rw-rw-r--. 1 hadoop hadoop 959984 Apr 21  2015 mysql-connector-java-5.1.33.jar
说明驱动包没有问题,经过百度后发现是配置文件$HIVE_HOME/conf/hive-site.xml内配置有问题:
<property>
   <name>javax.jdo.option.ConnectionURL</name>
   <value>
        jdbc:mysql://slave1:3306/hive?createDatabaseIfNotExist=true
</value>
   <description>JDBC connect string for a JDBC metastore</description>
</property>
上面是原来的配置,下面是修改后的配置:
<property>
   <name>javax.jdo.option.ConnectionURL</name>
   <value>jdbc:mysql://slave1:3306/hive?createDatabaseIfNotExist=true</value>
   <description>JDBC connect string for a JDBC metastore</description>
</property>

原因是配置文件中的<value></value>中的内容必须在同一行上且不能有空格,即不能包含换行符和空格,否则就会出错,请检查其它的配置是否还在存在这类问题。

修改完成后,再次启动就成功了。
[hadoop@master bin]$ ./hive

Logging initialized using configuration in file:/home/hadoop/bigdataspace/hive-1.1.0-cdh5.5.0/conf/hive-log4j.properties
WARNING: Hive CLI is deprecated and migration to Beeline is recommended.
hive (default)> show tables ;
OK
tab_name
Time taken: 0.64 seconds
hive (default)> 
阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/dmcpxy/article/details/52317536
文章标签: hive hadoop
个人分类: 大数据 互联网 Java
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭