java.lang.NullPointerException at java.lang.ProcessBuilder.start(Unknown Source) at org.apache.hadoop.util.Shell.runCommand(Shell.java:482)

时间:2023-02-01 03:00:24

1:问题出现的原因,部署好的hadoop-2.6.4进行window10操作hadoop api出现的错误,具体错误是我向hdfs上传文件,还好点,之前解决过,这里不叙述,这里说一下从hdfs下载文件出现的错误:

详细错误如下所示:

java.lang.NullPointerException
at java.lang.ProcessBuilder.start(Unknown Source)
at org.apache.hadoop.util.Shell.runCommand(Shell.java:)
at org.apache.hadoop.util.Shell.run(Shell.java:)
at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:)
at org.apache.hadoop.util.Shell.execCommand(Shell.java:)
at org.apache.hadoop.util.Shell.execCommand(Shell.java:)
at org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:)
at org.apache.hadoop.fs.FilterFileSystem.setPermission(FilterFileSystem.java:)
at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:)
at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:)
at org.apache.hadoop.fs.FileUtil.copy(FileUtil.java:)
at org.apache.hadoop.fs.FileUtil.copy(FileUtil.java:)
at org.apache.hadoop.fs.FileUtil.copy(FileUtil.java:)
at org.apache.hadoop.fs.FileSystem.copyToLocalFile(FileSystem.java:)
at org.apache.hadoop.fs.FileSystem.copyToLocalFile(FileSystem.java:)
at org.apache.hadoop.fs.FileSystem.copyToLocalFile(FileSystem.java:)
at com.bie.lesson01.HdfsClientTest.downloadFile(HdfsClientTest.java:)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$.runReflectiveCall(FrameworkMethod.java:)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:)
at org.junit.runners.ParentRunner$.run(ParentRunner.java:)
at org.junit.runners.ParentRunner$.schedule(ParentRunner.java:)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:)
at org.junit.runners.ParentRunner.access$(ParentRunner.java:)
at org.junit.runners.ParentRunner$.evaluate(ParentRunner.java:)
at org.junit.runners.ParentRunner.run(ParentRunner.java:)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:)

确实如很多网友说的:
出现原因:缺少hadoop.dll或winutils.exe

解决办法:缺少哪个,就在本地的E:\hadoop\hadoop-2.6.4\bin下加上哪个。
而这个方法,貌似不好使,经过亲自测试,解决方法如下所示:

在你的bin目录里面加上这两个文件,然后呢,在你的C:\Windows\System32加上hadoop.dll就可以解决上面出现的错误。

而且可以完成你想要完成的操作:

资源下载地址:http://download.csdn.net/download/biexiansheng/10132712
java.lang.NullPointerException 	at java.lang.ProcessBuilder.start(Unknown Source) 	at org.apache.hadoop.util.Shell.runCommand(Shell.java:482)

java.lang.NullPointerException 	at java.lang.ProcessBuilder.start(Unknown Source) 	at org.apache.hadoop.util.Shell.runCommand(Shell.java:482)

停更......

2017-11-25 17:28:05