Yes i copied my input file as -copyFromLocal
But the java.io.FileNotFoundException: File does not exist:
/user/sree/C45/intermediate1.txt is happenning as part of my Reduce function
C45 id=new C45();
System.out.println("count "+cnt);
Path input = new Path("C45/intermediate"+id.current_index+".txt");
//Path chck = new Path("C45/cnt_"+id.current_index+".txt");
Configuration conf = new Configuration();
conf.set("fs.defaultFS", "hdfs://my remote-ip/");
conf.set("hadoop.job.ugi", "hdfs");
FileSystem fs = FileSystem.get(conf);
BufferedWriter bw = new BufferedWriter(
new OutputStreamWriter(fs.create(input, true)));
System.out.println("Text from Reducer: "+
"C45/intermediate"+id.current_index+".txt"+ text);
System.out.println("file
exists:/user/dataadmin/C45/intermediate"+id.current_index+".txt"+fs.exists(input));
for(String str: text) {
bw.write(str);
}
bw.newLine();
bw.close();
As part of this code
Several intermediate files are created:
C45/intermediate0.txt
C45/intermediate1.txt
C45/intermediate2.txt
C45/intermediate3.txt
C45/intermediate4.txt
C45/intermediate5.txt
C45/intermediate6.txt
C45/intermediate7.txt
C45/rule.txt
I tried it from Eclipse
giving
Configuration conf = new Configuration();
conf.set("fs.defaultFS", "hdfs://my remote-ip/");
conf.set("hadoop.job.ugi", "hdfs");
FileSystem fs = FileSystem.get(conf);
My decision tree is successfull
But wen i export my program as jar file and run in cluster the above error
is happenening
But 2 files are created
C45/intermediate0.txt and C45/rule.txt.....
But this results in a wrong output.
On Thu, Dec 12, 2013 at 3:37 PM, John Hancock <[email protected]>wrote:
> Is the file actually in hdfs? Did you run "hadoop dfs -copyFromLocal
> <file-name> <hdfs-destination>"
>
>
> On Wed, Dec 11, 2013 at 5:53 AM, unmesha sreeveni
> <[email protected]>wrote:
>
>> I am trying to run Decision Tree in Hadoop MapReduce.
>>
>> But it is showing java.io.FileNotFoundException: File does not exist: in
>> cluster. But when i tried it from Eclipse it is showing the correct result
>> with the below settings
>>
>> Configuration conf = new Configuration();
>> conf.set("fs.defaultFS", "remotesystem-ip/");
>> conf.set("hadoop.job.ugi", "hdfs");
>> And it created all the intermediate files under /user/sree/C45
>>
>> hadoop fs -ls /user/sree/C45
>> Found 9 items
>> -rw-r--r-- 3 sree supergroup 263 2013-12-11 15:56
>> /user/sree/C45/intermediate0.txt
>> -rw-r--r-- 3 sree supergroup 106 2013-12-11 15:56
>> /user/sree/C45/intermediate1.txt
>> -rw-r--r-- 3 sree supergroup 130 2013-12-11 15:56
>> /user/sree/C45/intermediate2.txt
>> -rw-r--r-- 3 sree supergroup 128 2013-12-11 15:56
>> /user/sree/C45/intermediate3.txt
>> -rw-r--r-- 3 sree supergroup 54 2013-12-11 15:56
>> /user/sree/C45/intermediate4.txt
>> -rw-r--r-- 3 sree supergroup 50 2013-12-11 15:56
>> /user/sree/C45/intermediate5.txt
>> -rw-r--r-- 3 sree supergroup 48 2013-12-11 15:56
>> /user/sree/C45/intermediate6.txt
>> -rw-r--r-- 3 sree supergroup 53 2013-12-11 15:56
>> /user/sree/C45/intermediate7.txt
>> -rw-r--r-- 3 sree supergroup 97 2013-12-11 15:56
>> /user/sree/C45/rule.txt
>> When i tried exporting my jar on remote cluster and ran my job it is
>> showing
>>
>> In gainratio --- getcount
>> file exists:C45/intermediate1.txtfalse
>>
>> java.io.FileNotFoundException: File does not exist:
>> /user/sree/C45/intermediate1.txt
>> at
>> org.apache.hadoop.hdfs.server.namenode.INodeFile.valueOf(INodeFile.java:39)
>> at
>> org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocationsUpdateTimes(FSNamesystem.java:1341)
>> at
>> org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocationsInt(FSNamesystem.java:1293)
>> at
>> org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocations(FSNamesystem.java:1269)
>> at
>> org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocations(FSNamesystem.java:1242)
>> at
>> org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.getBlockLocations(NameNodeRpcServer.java:392)
>> at
>> org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.getBlockLocations(ClientNamenodeProtocolServerSideTranslatorPB.java:172)
>> at
>> org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java:44938)
>> at
>> org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:453)
>> at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1002)
>> at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1701)
>> at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1697)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at javax.security.auth.Subject.doAs(Subject.java:415)
>> at
>> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1408)
>> at org.apache.hadoop.ipc.Server$Handler.run(Server.java:1695)
>>
>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>> Method)
>> at
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
>> at
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>> at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
>> at
>> org.apache.hadoop.ipc.RemoteException.instantiateException(RemoteException.java:90)
>> at
>> org.apache.hadoop.ipc.RemoteException.unwrapRemoteException(RemoteException.java:57)
>> at
>> org.apache.hadoop.hdfs.DFSClient.callGetBlockLocations(DFSClient.java:972)
>> at
>> org.apache.hadoop.hdfs.DFSClient.getLocatedBlocks(DFSClient.java:960)
>> at
>> org.apache.hadoop.hdfs.DFSInputStream.fetchLocatedBlocksAndGetLastBlockLength(DFSInputStream.java:238)
>> at
>> org.apache.hadoop.hdfs.DFSInputStream.openInfo(DFSInputStream.java:205)
>> at
>> org.apache.hadoop.hdfs.DFSInputStream.<init>(DFSInputStream.java:198)
>> at org.apache.hadoop.hdfs.DFSClient.open(DFSClient.java:1117)
>> at
>> org.apache.hadoop.hdfs.DistributedFileSystem.open(DistributedFileSystem.java:249)
>> at
>> org.apache.hadoop.hdfs.DistributedFileSystem.open(DistributedFileSystem.java:82)
>> at org.apache.hadoop.fs.FileSystem.open(FileSystem.java:746)
>> at tech.GainRatio.getcount(GainRatio.java:121)
>> at tech.C45.main(C45.java:140)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.lang.reflect.Method.invoke(Method.java:601)
>> at org.apache.hadoop.util.RunJar.main(RunJar.java:208)
>> Caused by:
>> org.apache.hadoop.ipc.RemoteException(java.io.FileNotFoundException): File
>> does not exist: /user/sree/user/dataadmin/C45/intermediate1.txt
>> at
>> org.apache.hadoop.hdfs.server.namenode.INodeFile.valueOf(INodeFile.java:39)
>> at
>> org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocationsUpdateTimes(FSNamesystem.java:1341)
>> at
>> org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocationsInt(FSNamesystem.java:1293)
>> at
>> org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocations(FSNamesystem.java:1269)
>> at
>> org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocations(FSNamesystem.java:1242)
>> at
>> org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.getBlockLocations(NameNodeRpcServer.java:392)
>> at
>> org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.getBlockLocations(ClientNamenodeProtocolServerSideTranslatorPB.java:172)
>> at
>> org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java:44938)
>> at
>> org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:453)
>> at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1002)
>> at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1701)
>> at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1697)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at javax.security.auth.Subject.doAs(Subject.java:415)
>> at
>> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1408)
>> at org.apache.hadoop.ipc.Server$Handler.run(Server.java:1695)
>>
>> at org.apache.hadoop.ipc.Client.call(Client.java:1225)
>> at
>> org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:202)
>> at $Proxy9.getBlockLocations(Unknown Source)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.lang.reflect.Method.invoke(Method.java:601)
>> at
>> org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:164)
>> at
>> org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:83)
>> at $Proxy9.getBlockLocations(Unknown Source)
>> at
>> org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.getBlockLocations(ClientNamenodeProtocolTranslatorPB.java:155)
>> at
>> org.apache.hadoop.hdfs.DFSClient.callGetBlockLocations(DFSClient.java:970)
>> ... 15 more
>> Why are my intermediate files not getting created in my remote system.
>>
>> Am i doing anything wrong: Source:
>> https://github.com/studhadoop/MyC45/tree/master/tech
>>
>> --
>> *Thanks & Regards*
>>
>> Unmesha Sreeveni U.B
>>
>> *Junior Developer*
>>
>>
>>
>
--
*Thanks & Regards*
Unmesha Sreeveni U.B
*Junior Developer*