Pivotal Knowledge Base

Follow

Beeline CLI gives error "The initCause method cannot be used" when connecting to Hive

Environment

Product Version
Pivotal HD 3.x
Hive 0.14

Symptom

When trying to connect to Hive via the Beeline CLI, the following error is seen:

The initCause method cannot be used. To set the cause of this exception, use a constructor with a Throwable[] argument.

Error Message:

In the /var/log/hive/hiveserver2.log, the following messages are seen:

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.

Cause

The MySQL database has dropped the connection from Beeline to MySQL. The MySQL logs should be investigated to fully understand why.

Resolution

As the root cause of the issue is the MySQL database dropping the connections, the MySQL logs should 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:

Solution 1 (preferred):  Take MySQL wait_timeout out up; review the MySQL documentation to do this. 

Solution 2: Under Ambari / HIVE / Configs / Advanced / Hive Metastore, modify the configuration "Database URL" to include "?auto-Reconnect=true". An example is shown here:

Restart Hive services as requested by Ambari after making the above changes.

 

Comments

Powered by Zendesk