When trying to connect to Hive through the Beeline CLI, the following error is produced:
The initCause method cannot be used. To set the cause of this exception, use a constructor with a Throwable[] argument.
In the /var/log/hive/hiveserver2.log, the following error messages are produced:
2016-07-04 02:09:41,465 ERROR [HiveServer2-Handler-Pool: Thread-61]: bonecp.ConnectionHandle (ConnectionHandle.java:markPossiblyBroken(388)) - Database access problem. Killing off this connection and all remaining connections in the connection pool. SQL State = 08S01 2016-07-04 02:09:41,489 WARN [HiveServer2-Handler-Pool: Thread-61]: metastore.MetaStoreDirectSql (MetaStoreDirectSql.java:ensureDbInit(198)) - Database initialization failed; direct SQL is disabled javax.jdo.JDODataStoreException: The last packet successfully received from the server was 2,339,055 milliseconds ago. The last packet sent successfully to the server was 2,339,055 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
The MySQL database dropped the connection from Beeline to MySQL. The MySQL logs should be need to be investigated to fully understand why.
The the MySQL database dropping the connections. The MySQL logs need to be investigated to understand why. The most common reason for the MySQL database dropping the connection is that a timeout has been reached. If that is the case, two solutions that may help are:
Increase the value of the MySQL parameter wait_timeout. Review the MySQL documentation to do this.
Under Ambari / HIVE / Configs / Advanced / Hive Metastore, modify the configuration "Database URL" to include "?auto-Reconnect=true". An example is shown below:
Restart Hive services as requested by Ambari after making the above changes.