[Continuously Updated] Solution of Hive exception

1. View Hive logs

The file path

  • /tmp/<user.name>/hive.log
  • The default user. Name is root




2. Failed to load data

An error prompt

Loading data to table default.test01 Failed with exception Unable to move source file:/root/hive_test.txt to destination  hdfs://bigdata01:9000/user/hive/warehouse/test01/hive_test_copy_1.txt FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTaskCopy the code

Abnormal reason

  • The Datanode is not started properly

The solution

  • Restarting the Hadoop Cluster




3. Failed to load the driver

An error prompt

Caused by: org.datanucleus.store.rdbms.connectionpool.DatastoreDriverNotFoundException: 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. at org.datanucleus.store.rdbms.connectionpool.AbstractConnectionPoolFactory.loadDriver(AbstractConnectionPoolFactory.java:5 8) at org.datanucleus.store.rdbms.connectionpool.BoneCPConnectionPoolFactory.createConnectionPool(BoneCPConnectionPoolFactory. java:54) at org.datanucleus.store.rdbms.ConnectionFactoryImpl.generateDataSources(ConnectionFactoryImpl.java:213)Copy the code

Abnormal reason

  • MySQL driver package missing

The solution

  • Upload the mysql driver package to the lib directory of hive




4. The Hive construction report is incorrect

An error prompt

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:An exception was thrown while adding/validating class(es) : Column length too big for column 'TYPE_NAME' (max = 21845); use BLOB or TEXT instead
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Column length too big for column 'TYPE_NAME' (max = 21845); use BLOB or TEXT instead
Copy the code

Abnormal reason

  • The MySQL encoding format is incorrect

The solution

  • Log in to MySQL and execute:
    • Use Hive database name
    • To view the current encoding:
    • show variables like "char%";
    • Modify code:
    • Alter database Hive database name character set latin1;