java - org.apache.hadoop.security.UserGroupInformation security exception error -
hi trying create file in hdfs java program.but getting security exception
java.lang.noclassdeffounderror: not initialize class org.apache.hadoop.security.usergroupinformation @ org.apache.hadoop.fs.filesystem$cache$key.<init>(filesystem.java:2806) @ org.apache.hadoop.fs.filesystem$cache$key.<init>(filesystem.java:2798) @ org.apache.hadoop.fs.filesystem$cache.get(filesystem.java:2661)
my java code.
configuration conf = new configuration(); conf.set("fs.hdfs.impl", org.apache.hadoop.hdfs.distributedfilesystem.class.getname()); conf.set("fs.file.impl", org.apache.hadoop.fs.localfilesystem.class.getname()); conf.addresource(new path("/etc/hadoop/conf/core-site.xml")); conf.addresource(new path("/etc/hadoop/conf/hdfs-site.xml")); bufferedwriter br = null; filesystem hdfs = null; try { java.util.date date = new java.util.date(); hdfs = filesystem.get(new uri("hdfs://aserver:8020"), conf); path file = new path( "hdfs://aserver:8020/user/ec2-user/addressinformation/" + date.gettime()); outputstream os = hdfs.create(file); br = new bufferedwriter(new outputstreamwriter(os, "utf-8")); br.write(result); br.close(); hdfs.close(); return result; } catch (exception e) { return "error"; } } }
any appreciated.
Comments
Post a Comment