当前位置:首页 > 服务端 > Spring Boot 项目访问hbase 编译遇到 java.io.FileNotFoundException: HADOOP_HOME and hadoop.home.dir are unset

Spring Boot 项目访问hbase 编译遇到 java.io.FileNotFoundException: HADOOP_HOME and hadoop.home.dir are unset

在window 10 系统下,使用idea创建了一个spring boot 项目,并使用hbase-client 接口访问hbase(hbase 在WSL 子系统启动),在编译的时候,遇到如下错误:

Spring Boot 项目访问hbase 编译遇到 java.io.FileNotFoundException: HADOOP_HOME and hadoop.home.dir are unset _ JavaClub全栈架构师技术笔记

 

根据提示,打开链接:https://cwiki.apache.org/confluence/display/HADOOP2/WindowsProblems (原来的链接地址已经移动到新地址了),如下对问题的描述:

Problems running Hadoop on Windows

Hadoop requires native libraries on Windows to work properly -that includes to access the file:// filesystem, where Hadoop uses some Windows APIs to implement posix-like file access permissions.

This is implemented in HADOOP.DLL and WINUTILS.EXE.

In particular, %HADOOP_HOME%\BIN\WINUTILS.EXE must be locatable.

If it is not, Hadoop or an application built on top of Hadoop will fail.
How to fix a missing WINUTILS.EXE

You can fix this problem in two ways

    Install a full native windows Hadoop version. The ASF does not currently (September 2015) release such a version; releases are available externally.
    Or: get the WINUTILS.EXE binary from a Hadoop redistribution. There is a repository of this for some Hadoop versions on github.

Then

    Set the environment variable %HADOOP_HOME% to point to the directory above the BIN dir containing WINUTILS.EXE.
    Or: run the Java process with the system property hadoop.home.dir set to the home directory.

 

提示需要设置HADOOP_HOME 环境变量,并下载相应的HADOOP.DLL and WINUTILS.EXE,于是打开wiki 中的Git,找到相应版本的hadoop,并下载这2个文件到本地目录,

因本地也下载了spark,把这2个文件保存到 C:\Application\spark-3.2.0-bin-hadoop3.2-scala2.13\bin 目录,添加环境变量 HADOOP_HOME, 并在Path 变量里添加路径:%HADOOP_HOME%\bin, 保存变量

Spring Boot 项目访问hbase 编译遇到 java.io.FileNotFoundException: HADOOP_HOME and hadoop.home.dir are unset _ JavaClub全栈架构师技术笔记

 

 

重新打开idea,并编译项目,错误消失

作者:黎明踏浪号
来源链接:https://www.cnblogs.com/benfly/p/16660894.html

版权声明:
1、Java侠(https://www.javaxia.com)以学习交流为目的,由作者投稿、网友推荐和小编整理收藏优秀的IT技术及相关内容,包括但不限于文字、图片、音频、视频、软件、程序等,其均来自互联网,本站不享有版权,版权归原作者所有。

2、本站提供的内容仅用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律的规定,不得侵犯相关权利人及本网站的合法权利。
3、本网站内容原作者如不愿意在本网站刊登内容,请及时通知本站(javaclubcn@163.com),我们将第一时间核实后及时予以删除。





本文链接:https://www.javaxia.com/server/124966.html

分享给朋友:

“Spring Boot 项目访问hbase 编译遇到 java.io.FileNotFoundException: HADOOP_HOME and hadoop.home.dir are unset” 的相关文章