getting error in hive

这一生的挚爱 提交于 2020-01-22 12:57:46

问题


When i am connected to the ireport, then if a say show tables in hive shell,this error is coming:

Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask


回答1:


Have you copied the jar containing the JDBC driver for your metadata db into Hive's lib dir?

For instance, if you're using MySQL to hold your metadata db, you wll need to copy

mysql-connector-java-5.1.22-bin.jar into $HIVE_HOME/lib.

This fixed that same error for me.




回答2:


One possibility is that your hadoop is not running. I ran into this same problem when doing a simple one node hadoop cluster on my local. Each time you start up your computer you have to manually start your hadoop nodes before hive can connect to them.

Try running $HADOOP_HOME/bin/stop-all.sh

If the output says there were no nodes to stop, that means your hadoop wasn't up, in this case, run

$HADOOP_HOME/bin/start-all.sh

and then hive and you should be good to go.

(this was using the default derby database. Apparently if you are using mysql then you can also get this error from some connector configuration (see other answer)).

EDIT: Actually another thing I discovered is that Hive needs to create a metastore_db directory whenever you start hive, but it creates it in the path that hive was run from. You can encounter the above error if you don't have write permission in the directory that you run hive from. To fix this, there's a config you can set in hive-site.xml to make this directory absolute rather than relative.

See here:

metastore_db created wherever I run Hive




回答3:


The error messages are great in Hive. When I added the creds into conf/hive-site.xml I didn't notice the pre-existing username/password elements, so when I added my own they weren't used and I ended up with the same nondescript message as above.

If you run the metatool command it stack-traces and you get this, which in my case pointed to the real cause. I hope this helps somebody else:

mfellows@matt.mit /usr/local/hive-0.11.0-bin $ bin/metatool -listFSRoot
Initializing HiveMetaTool..
13/06/05 21:44:43 INFO metastore.ObjectStore: ObjectStore, initialize called
13/06/05 21:44:43 ERROR DataNucleus.Plugin: Bundle "org.eclipse.jdt.core" requires "org.eclipse.core.resources" but it cannot be resolved.
13/06/05 21:44:43 ERROR DataNucleus.Plugin: Bundle "org.eclipse.jdt.core" requires "org.eclipse.core.runtime" but it cannot be resolved.
13/06/05 21:44:43 ERROR DataNucleus.Plugin: Bundle "org.eclipse.jdt.core" requires "org.eclipse.text" but it cannot be resolved.
13/06/05 21:44:43 INFO DataNucleus.Persistence: Property datanucleus.cache.level2 unknown - will be ignored
13/06/05 21:44:43 INFO DataNucleus.Persistence: Property javax.jdo.option.NonTransactionalRead unknown - will be ignored
13/06/05 21:44:43 INFO DataNucleus.Persistence: ================= Persistence Configuration ===============
13/06/05 21:44:43 INFO DataNucleus.Persistence: DataNucleus Persistence Factory - Vendor: "DataNucleus"  Version: "2.0.3"
13/06/05 21:44:43 INFO DataNucleus.Persistence: DataNucleus Persistence Factory initialised for datastore     URL="jdbc:mysql://localhost/hive_metastore" driver="com.mysql.jdbc.Driver" userName="APP"
13/06/05 21:44:43 INFO DataNucleus.Persistence: ===========================================================
13/06/05 21:44:44 ERROR Datastore.Schema: Failed initialising database.
Access denied for user 'APP'@'localhost' (using password: YES)
org.datanucleus.exceptions.NucleusDataStoreException: Access denied for user 'APP'@'localhost' (using password: YES)
  at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.getConnection(ConnectionFactoryImpl.java:536)



回答4:


Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient

In general, this indicates that the Hive metastore service isn't started properly. But the error message you paste doesn't contain sufficient information to locate the exact cause of the problem.
Indeed, there are quite a lot reasons which may lead to this error, as the answers posted by other authors each relate to a specific aspect.
My suggestion is: run hive --service metastore command to get a more detailed and targeted error message, and then address the problem accordingly. You may refer to /tmp/user_name/hive.log log file, too.




回答5:


I was told that generally we get this exception if we the hive console not terminated properly. The fix:

Run the jps command, look for "RunJar" process and kill it using kill -9 command




回答6:


Thanks for the answer above with respect to the JDBC driver. I'm using Oracle for the Hive Metastore, therefore:

$ cp $ORACLE_HOME/jdbc/lib/ojdbc6.jar $HIVE_HOME/lib/ojdbc6.jar



来源:https://stackoverflow.com/questions/14452861/getting-error-in-hive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!