After setup the hadoop configuration I got java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apache.hadoop.fs.LocalFileSystem
even when org.apache.hadoop.fs.LocalFileSystem
is present in the jar file .
Asked
Active
Viewed 103 times
0

Cherry
- 31,309
- 66
- 224
- 364
1 Answers
0
Solution is to "remove" classloader
from getClassByName
function. E.g. create org.apache.hadoop.conf.Configuration
with getClass
overrided method, like:
Configuration hadoopConfig = new Configuration() {
public Class<?> getClassByName(String name) throws ClassNotFoundException {
return Class.forName(name);
}
};
Notes
- This is just work implementation. Original implementation uses
Class.forName(name, true, classLoader);
so new overrided code may not work if so addif
statement to change logic obly fororg.apache.hadoop.fs.LocalFileSystem
- The error happened and fixed only for AWS lambda. In other environments (like true Hadoop cluster) this may not be an appropriate solution

Cherry
- 31,309
- 66
- 224
- 364