Eclipse调试Hbase程序“Failed to detect a valid hadoop home directory java.id.IOException”问题
来源:互联网 发布:骑马与砍杀哈劳斯数据 编辑:程序博客网 时间:2024/06/05 07:28
在eclipse调试hbase程序时发现如下日志:
2014-11-21 16:27:56,030 DEBUG [org.apache.hadoop.util.Shell] - Failed to detect a valid hadoop home directory
java.io.IOException : HADOOP_HOME or hadoop.home.dir are not set.
at org.apache.hadoop.util.Shell.checkHadoopHome( Shell.java:225)
at org.apache.hadoop.util.Shell.<clinit>( Shell.java:250)
at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:76)
at org.apache.hadoop.conf.Configuration.getStrings(Configuration.java:1514)
at org.apache.hadoop.hbase.zookeeper.ZKConfig.makeZKProps(ZKConfig.java:113)
at org.apache.hadoop.hbase.zookeeper.ZKConfig.getZKQuorumServersString(ZKConfig.java:265)
at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:159)
at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:134)
at org.apache.hadoop.hbase.client.ZooKeeperKeepAliveConnection.<init>(ZooKeeperKeepAliveConnection.java:43)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getKeepAliveZooKeeperWatcher(HConnectionManager.java:1763)
at org.apache.hadoop.hbase.client.ZooKeeperRegistry.getClusterId(ZooKeeperRegistry.java:82)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.retrieveClusterId(HConnectionManager.java:852)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.<init>(HConnectionManager.java:657)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0( Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance( Constructor.java:513)
at org.apache.hadoop.hbase.client.HConnectionManager.createConnection(HConnectionManager.java:409)
at org.apache.hadoop.hbase.client.HConnectionManager.createConnection(HConnectionManager.java:304)
at com.emar.adx.yiqifa.dal.common.hbase.HBaseConnectionFactory.getConnection(HBaseConnectionFactory.java:54)
at com.emar.adx.yiqifa.dal.common.hbase.HBaseUtils.getConnnection(HBaseUtils.java:34)
at com.emar.adx.yiqifa.dal.common.hbase.HBaseUtilsTest.testGetTable(HBaseUtilsTest.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0( Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke( Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run( ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule( ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000( ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run( ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
从日志上来看这只是一个debug信息,但探索究竟是程序员的天性,于是毅然决然的走上了探寻究竟的道路,行从Shell.java开始,Shell.java中通过System.getProperties("hadoop.home.dir")和System.env("HADOOP_HOME")获取HADOOP_HOME目录,如果在开发环境中没有设置这两个环境变量任何一个,程序运行是就会打出上面的日志。
知道了日志输出的原因就有了解决办法(假设开发环境中hadoop安装在d:\hadoop目录下):
方法一:在windows中设置环境变量HOADOOP_HOME=d:\hadoop
方法二:在测试程序时通过System.setProperty("hadoop.home.dir", "d:\\hadoop")
方法二:在测试程序时通过System.setProperty("hadoop.home.dir", "d:\\hadoop")
以上日志不是HBase的程序输出的,在Hadoop开发中也会遇到这样的日志,也可以通过上面的方法解决。
0 0
- Eclipse调试Hbase程序“Failed to detect a valid hadoop home directory java.id.IOException”问题
- jenkins error:java.io.IOException: Failed to create a directory at ...
- JAVA的HttpClient问题:The server failed to respond with a valid HTTP response
- Warning the selected directory is not a valid tomcat home
- Hadoop datanode 无法启动,报错:java.io.IOException: All specified directories are failed to load.
- 程序开过多线程,导致hadoop作业无法运行成功——Call to hadoop1:9000 failed on lo cal exception: java.io.IOException: Coul
- java.io.IOException: Mkdirs failed to create
- Hadoop与HBase中遇到的问题(续)java.io.IOException: Non-increasing Bloom keys异常
- IntelliJ IDEA导入JDK出现The selected directory is not a valid home for JDK问题的解决方法
- java.io.IOException: File /home/hadoop/mapred/system/jobtracker.info could only be replicated to 0 n
- java.io.IOException: File /home/hadoop/mapred/system/jobtracker.info could only be replicated to 0 n
- Hadoop格式化namenode错误:java.io.IOException: Cannot create directory
- hadoop eclipse 程序调试
- Eclipse 调试问题: Failed to allocate memory: 8
- java.io.IOException: Failed to replace a bad datanode on the existing pipeline due to no more good
- Failed to locate the winutils binary in the hadoop binary path java.io.IOException: Could not locat
- Eclipse下调试HBase程序报“Will not attempt to authenticate using SASL (java.lang.SecurityException : 无法定位登”
- 解决android Failed to rename directory 问题
- 外设与存储器交互方式总结
- leetcode解题笔记-Minimum Window Substring
- 解决500 OOPS: vsftpd: cannot locate user specified in 'ftp_username':ftp的问题
- Java SE 第十讲(面向对象之封装) 续
- 读书笔记——程序员成长的烦恼(吴亮等)
- Eclipse调试Hbase程序“Failed to detect a valid hadoop home directory java.id.IOException”问题
- 再探Objective-C.4
- HDU3639 Hawk-and-Chicken 强连通+缩点+建反向图
- 解决linux 下php中xdebug的报错 :Xdebug MUST be loaded as a Zend extension in Unknown on line 0
- 编译内核使用make menuconfig时出错, 是一个目录 停止
- Arduino学习笔记3--用模拟IO口实现呼吸LED灯
- first time picture
- quartz定时任务
- java 线程组简介