第一种:
Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V
解决:网上说是hadoop和hive的guava.jar版本不一致。
具体可参考文章:
第二种:
Exception in thread "main" java.lang.RuntimeException: java.net.ConnectException: Call From xxxx-VirtualBox/127.0.1.1 to localhost:9000 failed on connection exception: java.net.ConnectException: 拒绝连接; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
解决:Hadoop没有启动 启动之后就可以了,但我又出现了另一种错误,哭死。
第三种:
Exception in thread "main" java.lang.RuntimeException: org.apache.hadoop.hdfs.server.namenode.SafeModeException: Cannot create directory /tmp/hive. Name node is in safe mode.
解决:关闭Hadoop安全模式,虽然我的默认关闭,但我还是重新运行下面的代码,可以进入hive,但是还是有错误,太难了明天再弄。
hadoop dfsadmin -safemode get
第四种:
Required table missing : "VERSION" in Catalog "" Schema "". DataNucleus requires this table to perform its persistence operations. Either your MetaData is incorrect, or you need to enable "datanucleus.schema.autoCreateTables"
org.datanucleus.store.rdbms.exceptions.MissingTableException: Required table missing : "VERSION" in Catalog "" Schema "". DataNucleus requires this table to perform its persistence operations. Either your MetaData is incorrect, or you need to enable "datanucleus.schema.autoCreateTables"
at org.datanucleus.store.rdbms.table.Abs
FAILED: HiveException java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
这个错误忘记是怎么解决得了,后面通过元数据初始化命令发现是自己jdbc驱动没有查找,但是我有按照教程放在lib目录下,后面换了jdbc驱动的版本就可以了。
初始化元数据命令:
schematool -dbType mysql -initSchema --verbose
------------------------------------------------------分割线------------------------------------------------------------------
现在hive终于部署好了,太不容易了。要细心一点,对教程要理解,加上自己的思考,才能知其所以然。