报错一:
Caused by: org.datanucleus.exceptions.NucleusException: Attempt to invoke the “BONECP” plugin to create a ConnectionPool gave an error : The specified datastore driver (“com.mysql.jdbc.Driver”) was not found in the CLASSPATH. Please check your CLASSPATH specification, and the name of the driver.
解决方法:
将mysql驱动jar包导入hive/lib下
报错二:
SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
Error: Duplicate entry ‘1’ for key ‘PRIMARY’ (state=23000,code=1062)
hive2.0版本之后需要初始化
schematool -dbType mysql -initSchema
解决方法:
hive里面的hive-site.xml中配置的mysql的初始化数据库把这个数据库删掉
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://bigdata100:3306/metastore?createDatabaseIfNotExist=true</value>
</property>
删除metastore数据库
drop database DBNAME;
再重新执行初始化
schematool -dbType mysql -initSchema
返回结果
Starting metastore schema initialization to 2.3.0
Initialization script hive-schema-2.3.0.mysql.sql
Initialization script completed
schemaTool completed
则执行成功