Hadoop出现错误:WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable,解决方案

安装Hadoop的时候直接用的bin版本,根据教程安装好之后运行的时候发现出现了:WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 错误,百度很多都说是版本(32,64)问题,需要重新编译源码,历经一天的时间源码重新编译完成之后,再次运行仍旧有这个错误,google的解决方案是:

1.执行:$ export HADOOP_ROOT_LOGGER=DEBUG,console

查看具体的错误信息:

// :: DEBUG util.Shell: setsid exited with exit code
// :: DEBUG conf.Configuration: parsing URL jar:file:/usr/local/hadoop/share/hadoop/common/hadoop-common-2.7..jar!/core-default.xml
// :: DEBUG conf.Configuration: parsing input stream sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream@462ac22a
// :: DEBUG conf.Configuration: parsing URL file:/usr/local/hadoop/etc/hadoop/core-site.xml
// :: DEBUG conf.Configuration: parsing input stream java.io.BufferedInputStream@405a2273
// :: DEBUG lib.MutableMetricsFactory: field org.apache.hadoop.metrics2.lib.MutableRate org.apache.hadoop.security.UserGroupInformation$UgiMetrics.loginSuccess with annotation @org.apache.eName=Time, value=[Rate of successful kerberos logins and latency (milliseconds)], about=, always=false, type=DEFAULT, sampleName=Ops)
// :: DEBUG lib.MutableMetricsFactory: field org.apache.hadoop.metrics2.lib.MutableRate org.apache.hadoop.security.UserGroupInformation$UgiMetrics.loginFailure with annotation @org.apache.eName=Time, value=[Rate of failed kerberos logins and latency (milliseconds)], about=, always=false, type=DEFAULT, sampleName=Ops)
// :: DEBUG lib.MutableMetricsFactory: field org.apache.hadoop.metrics2.lib.MutableRate org.apache.hadoop.security.UserGroupInformation$UgiMetrics.getGroups with annotation @org.apache.hadme=Time, value=[GetGroups], about=, always=false, type=DEFAULT, sampleName=Ops)
// :: DEBUG impl.MetricsSystemImpl: UgiMetrics, User and group related metrics
// :: DEBUG util.KerberosName: Kerberos krb5 configuration not found, setting default realm to empty
// :: DEBUG security.Groups: Creating new Groups object
// :: DEBUG util.NativeCodeLoader: Trying to load the custom-built native-hadoop library...
// :: DEBUG util.NativeCodeLoader: Failed to load native-hadoop with error: java.lang.UnsatisfiedLinkError: no hadoop in java.library.path
// :: DEBUG util.NativeCodeLoader: java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
// :: WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
// :: DEBUG util.PerformanceAdvisory: Falling back to shell based
// :: DEBUG security.JniBasedUnixGroupsMappingWithFallback: Group mapping impl=org.apache.hadoop.security.ShellBasedUnixGroupsMapping
// :: DEBUG security.Groups: Group mapping impl=org.apache.hadoop.security.JniBasedUnixGroupsMappingWithFallback; cacheTimeout=; warningDeltaMs=
// :: DEBUG security.UserGroupInformation: hadoop login
// :: DEBUG security.UserGroupInformation: hadoop login commit
// :: DEBUG security.UserGroupInformation: using local user:UnixPrincipal: hadoop
// :: DEBUG security.UserGroupInformation: Using user: "UnixPrincipal: hadoop" with name hadoop
// :: DEBUG security.UserGroupInformation: User entry: "hadoop"
// :: DEBUG security.UserGroupInformation: UGI loginUser:hadoop (auth:SIMPLE)

其中有个warn信息,在这个信息附近找到一个:Failed to load native-hadoop with error: java.lang.UnsatisfiedLinkError,这表明是java.library.path出了问题,

解决方案是在文件hadoop-env.sh中增加:

export HADOOP_OPTS="-Djava.library.path=${HADOOP_HOME}/lib/native"

解决问题过程中遇到的比较好的链接:

http://blog.csdn.net/l1028386804/article/details/51538611

http://blog.csdn.net/xichenguan/article/details/38797331

http://www.chinahadoop.cn/classroom/5/thread/43

http://www.powerxing.com/install-hadoop-in-centos/

上一篇:spring中 context:property-placeholder 导入多个独立的 .properties配置文件


下一篇:【UVA 11865】 Stream My Contest (二分+MDST最小树形图)