Windows启动HDFS报错 - org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/lang/String;I)Z

1. 环境

  • 操作系统: Windows 7
  • Hadoop版本: 2.6.0
  • 2. 问题描述

    Windows 7 环境下启动 HDFS,执行 start-dfs.cmd 出现 org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/lang/String;I)Z 报错信息如下:

    2020-10-13 16:59:34,528 ERROR namenode.NameNode: Failed to start namenode.
    java.lang.UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/lang/String;I)Z
            at org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Native Method)
            at org.apache.hadoop.io.nativeio.NativeIO$Windows.access(NativeIO.java:606)
            at org.apache.hadoop.fs.FileUtil.canWrite(FileUtil.java:971)
            at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.analyzeStorage(Storage.java:613)
            at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.analyzeStorage(Storage.java:573)
            at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverStorageDirs(FSImage.java:365)
            at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:221)
            at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFSImage(FSNamesystem.java:1072)
            at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFromDisk(FSNamesystem.java:704)
            at org.apache.hadoop.hdfs.server.namenode.NameNode.loadNamesystem(NameNode.java:665)
            at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:727)
            at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:950)
            at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:929)
            at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1653)
            at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1720)
    2020-10-13 16:59:34,532 INFO util.ExitUtil: Exiting with status 1: java.lang.Uns
    atisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/
    lang/String;I)Z
    2020-10-13 16:59:34,534 INFO namenode.NameNode: SHUTDOWN_MSG:
    /************************************************************
    SHUTDOWN_MSG: Shutting down NameNode at jfp/172.18.16.27
    ************************************************************/