分享

错误总结FAILED: Error in metadata: java.lang.NullPointerException

nettman 2014-1-20 21:16:20 发表于 总结型 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 0 24837
本帖最后由 nettman 于 2014-1-20 21:38 编辑

错误类型1:
  1. FAILED: Error in metadata: java.lang.IllegalArgumentException: URI: does not have a scheme
  2. 2011-09-22 11:54:57,890 ERROR [main] session.SessionState$LogHelper(343): FAILED: Error in metadata: java.lang.IllegalArgumentException: URI: does not have a scheme
  3. org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.IllegalArgumentException: URI: does not have a scheme
  4. at org.apache.hadoop.hive.ql.metadata.Hive.getDatabase(Hive.java:1028)
  5. at org.apache.hadoop.hive.ql.metadata.Hive.databaseExists(Hive.java:1013)
  6. at org.apache.hadoop.hive.ql.exec.DDLTask.showTables(DDLTask.java:1691)
  7. at org.apache.hadoop.hive.ql.exec.DDLTask.execute(DDLTask.java:289)
  8. at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:130)
  9. at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:57)
  10. at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1063)
  11. at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:900)
  12. at org.apache.hadoop.hive.ql.Driver.run(Driver.java:748)
  13. at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:164)
  14. at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:241)
  15. at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:456)
  16. Caused by: java.lang.IllegalArgumentException: URI: does not have a scheme
  17. at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:127)
  18. at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:1855)
  19. at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:1865)
  20. at org.apache.hadoop.hive.ql.metadata.Hive.getDatabase(Hive.java:1024)
  21. ... 11 more
复制代码
然后启动后在控制台也收到这样一条Log:hive-log4j.properties not found

    源码调下来,发现是Hive在加载配置文件如hive-default.xml,hive-log4j.properties时采用这种方法:

  1. private ClassLoader classLoader;
  2.   {
  3.     classLoader = Thread.currentThread().getContextClassLoader();
  4.     if (classLoader == null) {
  5.       classLoader = Configuration.class.getClassLoader();
  6.     }
  7.   }
复制代码
控制台输出如下:    Run path:/home/hadoop/workspace/hive-0.7.0/bin/
    Exception in thread "main" java.lang.NullPointerException
    at com.guoyun.hive.study.basic.PrintSourcePath.main(PrintSourcePath.java:12)   在获取hive-default.xml文件源时报来空指针异常,现在将hive_home/conf下到文件拷到hive/bin下,再运行这个类就不会报错了,我的运行结果如下:    Run path:/home/hadoop/workspace/hive-0.7.0/bin/    hive-default.xml path:/home/hadoop/workspace/hive-0.7.0/bin/hive-default.xml   之后再来调试Hive源码,Log:hive-log4j.properties not found已经不出现了。同时也没这个错误来。该问题解决!
错误类型2:
  1. hive> show tables;
  2. Logging initialized using configuration in file:/root/hive-0.8.1/conf/hive-log4j.properties
  3. 12/11/14 17:14:50 INFO SessionState: Logging initialized using configuration in file:/root/hive-0.8.1/conf/hive-log4j.properties
  4. Hive history file=/tmp/root/hive_job_log_root_201211141714_197217004.txt
  5. 12/11/14 17:14:50 INFO exec.HiveHistory: Hive history file=/tmp/root/hive_job_log_root_201211141714_197217004.txt
  6. hive> show tables;
  7. 12/11/14 17:14:56 INFO ql.Driver: <PERFLOG method=compile>
  8. 12/11/14 17:14:56 INFO parse.ParseDriver: Parsing command: show tables
  9. 12/11/14 17:14:56 INFO parse.ParseDriver: Parse Completed
  10. 12/11/14 17:14:56 INFO ql.Driver: Semantic Analysis Completed
  11. 12/11/14 17:14:56 INFO ql.Driver: Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
  12. 12/11/14 17:14:56 INFO ql.Driver: </PERFLOG method=compile start=1352884496553 end=1352884496985 duration=432>
  13. 12/11/14 17:14:56 INFO ql.Driver: <PERFLOG method=Driver.execute>
  14. 12/11/14 17:14:56 INFO ql.Driver: Starting command: show tables
  15. 12/11/14 17:14:57 INFO metastore.HiveMetaStore: 0: Opening raw store with implemenation classrg.apache.hadoop.hive.metastore.ObjectStore
  16. 12/11/14 17:14:57 INFO metastore.ObjectStore: ObjectStore, initialize called
  17. 12/11/14 17:14:57 ERROR metastore.HiveMetaStore: JDO datastore error. Retrying metastore command after 1000 ms (attempt 1 of 1)
  18. 12/11/14 17:14:58 INFO metastore.HiveMetaStore: 0: Opening raw store with implemenation classrg.apache.hadoop.hive.metastore.ObjectStore
  19. 12/11/14 17:14:58 INFO metastore.ObjectStore: ObjectStore, initialize called
  20. FAILED: Error in metadata: javax.jdo.JDOFatalInternalException: Unexpected exception caught.
  21. NestedThrowables:
  22. java.lang.reflect.InvocationTargetException
  23. 12/11/14 17:14:59 ERROR exec.Task: FAILED: Error in metadata: javax.jdo.JDOFatalInternalException: Unexpected exception caught.
  24. NestedThrowables:
  25. java.lang.reflect.InvocationTargetException
  26. org.apache.hadoop.hive.ql.metadata.HiveException: javax.jdo.JDOFatalInternalException: Unexpected exception caught.
  27. NestedThrowables:
  28. java.lang.reflect.InvocationTargetException
  29.         at org.apache.hadoop.hive.ql.metadata.Hive.getDatabase(Hive.java:1099)
  30.         at org.apache.hadoop.hive.ql.metadata.Hive.databaseExists(Hive.java:1084)
  31.         at org.apache.hadoop.hive.ql.exec.DDLTask.showTables(DDLTask.java:1957)
  32.         at org.apache.hadoop.hive.ql.exec.DDLTask.execute(DDLTask.java:306)
  33.         at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:133)
  34.         at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:57)
  35.         at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1332)
  36.         at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1123)
  37.         at org.apache.hadoop.hive.ql.Driver.run(Driver.java:931)
  38.         at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:255)
  39.         at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:212)
  40.         at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:403)
  41.         at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:671)
  42.         at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:554)
  43.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  44.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  45.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  46.         at java.lang.reflect.Method.invoke(Method.java:597)
  47.         at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
  48. Caused by: javax.jdo.JDOFatalInternalException: Unexpected exception caught.
  49. NestedThrowables:
  50. java.lang.reflect.InvocationTargetException
  51.         at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1186)
  52.         at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:803)
  53.         at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:698)
  54.         at org.apache.hadoop.hive.metastore.ObjectStore.getPMF(ObjectStore.java:246)
  55.         at org.apache.hadoop.hive.metastore.ObjectStore.getPersistenceManager(ObjectStore.java:275)
  56.         at org.apache.hadoop.hive.metastore.ObjectStore.initialize(ObjectStore.java:208)
  57.         at org.apache.hadoop.hive.metastore.ObjectStore.setConf(ObjectStore.java:183)
  58.         at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62)
  59.         at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
  60.         at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.getMS(HiveMetaStore.java:407)
  61.         at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.executeWithRetry(HiveMetaStore.java:359)
  62.         at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB(HiveMetaStore.java:504)
  63.         at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.init(HiveMetaStore.java:266)
  64.         at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.<init>(HiveMetaStore.java:228)
  65.         at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:114)
  66.         at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:2110)
  67.         at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:2120)
  68.         at org.apache.hadoop.hive.ql.metadata.Hive.getDatabase(Hive.java:1095)
  69.         ... 18 more
  70. Caused by: java.lang.reflect.InvocationTargetException
  71.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  72.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  73.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  74.         at java.lang.reflect.Method.invoke(Method.java:597)
  75.         at javax.jdo.JDOHelper$16.run(JDOHelper.java:1958)
  76.         at java.security.AccessController.doPrivileged(Native Method)
  77.         at javax.jdo.JDOHelper.invoke(JDOHelper.java:1953)
  78.         at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1159)
  79.         ... 35 more
  80. Caused by: java.lang.NullPointerException
  81.         at org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle(NonManagedPluginRegistry.java:443)
  82.         at org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle(NonManagedPluginRegistry.java:355)
  83.         at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensions(NonManagedPluginRegistry.java:215)
  84.         at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensionPoints(NonManagedPluginRegistry.java:156)
  85.         at org.datanucleus.plugin.PluginManager.registerExtensionPoints(PluginManager.java:82)
  86.         at org.datanucleus.OMFContext.<init>(OMFContext.java:156)
  87.         at org.datanucleus.OMFContext.<init>(OMFContext.java:137)
  88.         at org.datanucleus.ObjectManagerFactoryImpl.initialiseOMFContext(ObjectManagerFactoryImpl.java:132)
  89.         at org.datanucleus.jdo.JDOPersistenceManagerFactory.initialiseProperties(JDOPersistenceManagerFactory.java:363)
  90.         at org.datanucleus.jdo.JDOPersistenceManagerFactory.<init>(JDOPersistenceManagerFactory.java:307)
  91.         at org.datanucleus.jdo.JDOPersistenceManagerFactory.createPersistenceManagerFactory(JDOPersistenceManagerFactory.java:255)
  92.         at org.datanucleus.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:182)
  93.         ... 43 more
  94. FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
  95. 12/11/14 17:14:59 ERROR ql.Driver: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
  96. 12/11/14 17:14:59 INFO ql.Driver: </PERFLOG method=Driver.execute start=1352884496986 end=1352884499172 duration=2186>
  97. 12/11/14 17:14:59 INFO ql.Driver: <PERFLOG method=releaseLocks>
  98. 12/11/14 17:14:59 INFO ql.Driver: </PERFLOG method=releaseLocks start=1352884499172 end=1352884499174 duration=2>
  99. hive>
复制代码
  1. hive> show tables;
  2. FAILED: Error in metadata: javax.jdo.JDOFatalInternalException: Unexpected exception caught.
  3. NestedThrowables:
  4. java.lang.reflect.InvocationTargetException
  5. FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
  6. hive>
复制代码
解决:把hadoop目录下的build目录删掉就好了
有的同学找不到build 目录:这里注释一下:

注释:
描述:Jdk 1.6.0
Hadoop 1.0.3
Hive 0.9.0

Hadoop运行正常,装Hive后,
修改hive-site.xml
DB不论是用Derby或者Mysql,都是报 javax.jdo.JDOFatalInternalException

原因:
hadoop在本地用ant build过,$HADOOP_HOME里会有build目录。


错误类型3:没有权限
起因是我重装了mysql数据库。
安装之后 把访问权限都配置好 :
GRANT ALL PRIVILEGES ON*.* TO 'hive'@'%' Identified by 'hive';  
GRANT ALL PRIVILEGES ON*.* TO 'hive'@'localhost' Identified by 'hive';  
GRANT ALL PRIVILEGES ON*.* TO 'hive'@'127.0.0.1' Identified by 'hive';  
本机地址: 192.168.103.43  机器名字:192-168-103-43
flush privileges;
启动hive 发生下面的错误:
  1. hive> show tables;
  2. FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
  3. FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
  4. FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClientFAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
  5. cd ${HIVE_HOME}/bin
  6. ./hive -hiveconf hive.root.logger=DEBUG,console
  7. hive> show tables;
复制代码
得到如下的错误信息(当然 不同的问题所产生的日志是不同的):
  1. Caused by: javax.jdo.JDOFatalDataStoreException: Access denied for user 'hive'@'192-168-103-43' (using password: YES)
  2. NestedThrowables:
  3. java.sql.SQLException: Access denied for user 'hive'@'192-168-103-43' (using password: YES)
  4.         at org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:298)
  5.         at org.datanucleus.jdo.JDOPersistenceManagerFactory.freezeConfiguration(JDOPersistenceManagerFactory.java:601)
  6.         at org.datanucleus.jdo.JDOPersistenceManagerFactory.createPersistenceManagerFactory(JDOPersistenceManagerFactory.java:286)
  7.         at org.datanucleus.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:182)
  8.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  9.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  10.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  11.         at java.lang.reflect.Method.invoke(Method.java:597)
  12.         at javax.jdo.JDOHelper$16.run(JDOHelper.java:1958)
  13.         at java.security.AccessController.doPrivileged(Native Method)
  14.         at javax.jdo.JDOHelper.invoke(JDOHelper.java:1953)
  15.         at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1159)
  16.         at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:803)
  17.         at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:698)
  18.         at org.apache.hadoop.hive.metastore.ObjectStore.getPMF(ObjectStore.java:262)
  19.         at org.apache.hadoop.hive.metastore.ObjectStore.getPersistenceManager(ObjectStore.java:291)
  20.         at org.apache.hadoop.hive.metastore.ObjectStore.initialize(ObjectStore.java:224)
  21.         at org.apache.hadoop.hive.metastore.ObjectStore.setConf(ObjectStore.java:199)
  22.         at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62)
  23.         at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
  24.         at org.apache.hadoop.hive.metastore.RetryingRawStore.<init>(RetryingRawStore.java:62)
  25.         at org.apache.hadoop.hive.metastore.RetryingRawStore.getProxy(RetryingRawStore.java:71)
  26.         at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.newRawStore(HiveMetaStore.java:413)
  27.         at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.getMS(HiveMetaStore.java:401)
  28.         at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB(HiveMetaStore.java:439)
  29.         at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.init(HiveMetaStore.java:325)
  30.         at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.<init>(HiveMetaStore.java:285)
  31.         at org.apache.hadoop.hive.metastore.RetryingHMSHandler.<init>(RetryingHMSHandler.java:53)
  32.         at org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:58)
  33.         at org.apache.hadoop.hive.metastore.HiveMetaStore.newHMSHandler(HiveMetaStore.java:4102)
  34.         at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:121)
  35.         ... 28 more
复制代码
发现数据库的权限  HIVE需要的是

'hive'@'192-168-103-43' 这个IP地址

然后试着在mysql中加上权限:

GRANT ALL PRIVILEGES ON*.* TO 'hive'@'192-168-103-43' Identified by 'hive';

flush privileges;




再次登录hive

hive> show tables;
OK

加微信w3aboutyun,可拉入技术爱好者群

没找到任何评论,期待你打破沉寂

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条