#Exception in thread "main" java.lang.NullPointerException

22 messages · Page 1 of 1 (latest)

astral grove
#

Trying to read files from arg[0] location and wordcount summary of all files to arg[1] by using Hadoop in AWS ElasticMapReduce. Working in local window environment but failed on AWS

    at bow.Bow.main(Bow.java:78)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:239)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:153)```
summer dirgeBOT
#

This post has been reserved for your question.

Hey @astral grove! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

astral grove
untold fractal
#

files is null

#

probably because the file specified in args[0] doesn't exist

astral grove
#

Im afraid .listFiles() dosent works in linux

untold fractal
untold fractal
#

it works for files and directories

#

like /home/youruser/somefile

astral grove
#

It works for offical hadoopwordcountexample

untold fractal
#

That probably doesn't use File

#

but instead URL or something like that I guess

astral grove
#
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
    at sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:427)
    at java.nio.file.Files.newDirectoryStream(Files.java:457)
    at bow.Bow.main(Bow.java:84)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:239)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:153)```
```java
java.nio.file.Path dir = FileSystems.getDefault().getPath( args[0] );
 DirectoryStream<java.nio.file.Path> stream = Files.newDirectoryStream( dir );
  for (java.nio.file.Path path : stream) {}```
#

Trying new stuff and still failed

astral grove
#

Turns out wildcard in augment works with hadoop addInputPath

    FileInputFormat.addInputPath(job, new Path(args[0]));

augment s3://zacattempt1/testFiles/file*.txt