hadoop上的FileNotFoundException(FileNotFoundException on hadoop)
在我的map函数中,我试图从distributedcache读取文件,将其内容加载到哈希映射中。
MapReduce作业的sys输出日志打印hashmap的内容。 这表明它已经找到了文件,已经加载到数据结构中并执行了所需的操作。 它遍历列表并打印其内容。 从而证明操作是成功的。
但是,在运行MR作业几分钟后,我仍然会收到以下错误:
13/01/27 18:44:21 INFO mapred.JobClient: Task Id : attempt_201301271841_0001_m_000001_2, Status : FAILED java.io.FileNotFoundException: File does not exist: /app/hadoop/jobs/nw_single_pred_in/predict at org.apache.hadoop.hdfs.DFSClient$DFSInputStream.openInfo(DFSClient.java:1843) at org.apache.hadoop.hdfs.DFSClient$DFSInputStream.(DFSClient.java:1834) at org.apache.hadoop.hdfs.DFSClient.open(DFSClient.java:578) at org.apache.hadoop.hdfs.DistributedFileSystem.open(DistributedFileSystem.java:154) at org.apache.hadoop.fs.FileSystem.open(FileSystem.java:427) at org.apache.hadoop.mapreduce.lib.input.LineRecordReader.initialize(LineRecordReader.java:67) at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.initialize(MapTask.java:522) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:763) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:370) at org.apache.hadoop.mapred.Child$4.run(Child.java:255) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:396) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121) at org.apache.hadoop.mapred.Child.main(Child.java:249)这是使用要放置在分布式缓存中的文件的位置初始化Path的部分
// inside main, surrounded by try catch block, yet no exception thrown here Configuration conf = new Configuration(); // rest of the stuff that relates to conf Path knowledgefilepath = new Path(args[3]); // args[3] = /app/hadoop/jobs/nw_single_pred_in/predict/knowledge.txt DistributedCache.addCacheFile(knowledgefilepath.toUri(), conf); job.setJarByClass(NBprediction.class); // rest of job settings job.waitForCompletion(true); // kick off load这个是在map函数中:
try { System.out.println("Inside try !!"); Path files[]= DistributedCache.getLocalCacheFiles(context.getConfiguration()); Path cfile = new Path(files[0].toString()); // only one file System.out.println("File path : "+cfile.toString()); CSVReader reader = new CSVReader(new FileReader(cfile.toString()),'\t'); while ((nline=reader.readNext())!=null) data.put(nline[0],Double.parseDouble(nline[1])); // load into a hashmap } catch (Exception e) {// handle exception }帮助赞赏。
干杯!
Inside my map function, I am trying to read a file from the distributedcache, load its contents into a hash map.
The sys output log of the MapReduce job prints the content of the hashmap. This shows that it has found the file, has loaded into the data structure and performed the needed operation. It iterates through the list and prints its contents. Thus proving that the operation was successful.
However, I still get the below error after a few minutes of running the MR job:
13/01/27 18:44:21 INFO mapred.JobClient: Task Id : attempt_201301271841_0001_m_000001_2, Status : FAILED java.io.FileNotFoundException: File does not exist: /app/hadoop/jobs/nw_single_pred_in/predict at org.apache.hadoop.hdfs.DFSClient$DFSInputStream.openInfo(DFSClient.java:1843) at org.apache.hadoop.hdfs.DFSClient$DFSInputStream.(DFSClient.java:1834) at org.apache.hadoop.hdfs.DFSClient.open(DFSClient.java:578) at org.apache.hadoop.hdfs.DistributedFileSystem.open(DistributedFileSystem.java:154) at org.apache.hadoop.fs.FileSystem.open(FileSystem.java:427) at org.apache.hadoop.mapreduce.lib.input.LineRecordReader.initialize(LineRecordReader.java:67) at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.initialize(MapTask.java:522) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:763) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:370) at org.apache.hadoop.mapred.Child$4.run(Child.java:255) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:396) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121) at org.apache.hadoop.mapred.Child.main(Child.java:249)Here's the portion which initializes Path with the location of the file to be placed in the distributed cache
// inside main, surrounded by try catch block, yet no exception thrown here Configuration conf = new Configuration(); // rest of the stuff that relates to conf Path knowledgefilepath = new Path(args[3]); // args[3] = /app/hadoop/jobs/nw_single_pred_in/predict/knowledge.txt DistributedCache.addCacheFile(knowledgefilepath.toUri(), conf); job.setJarByClass(NBprediction.class); // rest of job settings job.waitForCompletion(true); // kick off loadThis one is inside the map function:
try { System.out.println("Inside try !!"); Path files[]= DistributedCache.getLocalCacheFiles(context.getConfiguration()); Path cfile = new Path(files[0].toString()); // only one file System.out.println("File path : "+cfile.toString()); CSVReader reader = new CSVReader(new FileReader(cfile.toString()),'\t'); while ((nline=reader.readNext())!=null) data.put(nline[0],Double.parseDouble(nline[1])); // load into a hashmap } catch (Exception e) {// handle exception }Help appreciated.
Cheers !
原文:https://stackoverflow.com/questions/14553296
最满意答案
仅当元素不是灯箱时才触发点击,移除onclick属性
$('body').click(function(e){ console.log(e.target) if ( !$(e.target).closest('#html5box-html5-lightbox').length) { $('a.html5lightbox').trigger('click'); } });
trigger the click only if the element is not the lightbox ,renmove the onclick attribute
$('body').click(function(e){ console.log(e.target) if ( !$(e.target).closest('#html5box-html5-lightbox').length) { $('a.html5lightbox').trigger('click'); } });
相关问答
更多-
您为灯箱div设置了100%宽度,占据整页宽度。 因为
x
上的点击事件无法触发。 减少#lightbox宽度,并替换脚本中的以下代码部分, $("#backgroundPopup").show(); if ($('#lightbox').length > 0) { // #lightbox exists //place href as img src value 和, $("#backgroundPopup").click ... -
colorbox - 关闭父iframe并打开新的iframe灯箱(colorbox - close parent iframe and open new iframe lightbox)[2022-05-26]
我修复了它,但我仍然觉得需要一些东西^ _ ^ 它在Internet Explorer 8及以下版本中不起作用 ,我希望有人可以帮我解决这个问题吗? 请 :) $(document).ready(function(){ var y = $(document.body).height(); var x = $(document).width(); parent.$.colorbox.resize({innerWidth:x, innerHeight:y}); ... -
灯箱靠近体内(Lightbox close within body)[2023-11-08]
仅当元素不是灯箱时才触发点击,移除onclick属性 $('body').click(function(e){ console.log(e.target) if ( !$(e.target).closest('#html5box-html5-lightbox').length) { $('a.html5lightbox').trigger('click'); } }); https://jsfiddle.net/oxtr7me0/ trigge ... -
您甚至可以在没有JavaScript的情况下执行此操作,如下面的示例所示。 您所需要的只是使用相应的id和href来解决:target属性。 .lightbox { position: fixed; font-family: Arial, Helvetica, sans-serif; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0, 0, 0, 0.8); z-index: 99999; ...
-
在灯箱中打开不同的图像(Open different image in lightbox)[2023-10-22]
单击外框时关闭灯箱(Close lightbox when click outside box)[2023-07-15]
$('body').click(function(e) { if (!$(e.target).closest('#quick-view-modal').length){ $("#quick-view-modal").fadeOut(300); } }); $('body').click(function(e) { if (!$(e.target).closest('#quick-view-modal').length){ $("#quick-view ...这可能是因为您的灯箱div在DOM加载后动态加载 - 试试这个。 $('body').on('click', '#lightbox', function() { $('#lightbox').hide(); }); It could be because your lightbox div is being loaded dynamically after the DOM load - Try this. $('body').on('click', '#lightbox', function() ...灯箱位置(Lightbox position)[2023-11-30]
你不能以宽度和高度为百分比来居中(至少不使用JS) 。 但是,您可以设置静态高度和宽度,并将其居中设置如下: 使用top: 50%; left: 50%; top: 50%; left: 50%; 和静态,负顶部和左边距,这是元素宽度和高度的一半。 .white_content { display: none; position: fixed; top: 50%; left: 50%; margin: -166px 0 0 -166px; width: 300 ...检查下面的代码。 你可以使.box中心,并使用left:50%;top:50%;保持其相对于图像宽度的宽度left:50%;top:50%; (值取决于绝对框相对于父对象的宽度,在本例中为body )并且还添加了transform:translate(-50%;-50%) (取决于.box维度的值),因此它将垂直和水平居中 加。 在图像上添加max-width:100%以在不同屏幕上响应。 如果这是你想要的,请告诉我 检查片段或小提琴Jsfiddle $(document).ready(function() ...使用灯箱搜索弹出框(Search popup box using lightbox)[2022-03-30]
我犯的错误很简单。 我把错误的行放在了正确的顺序上。 这条线必须放在首位。 所以在.css和javascript文件之前 我希望这个答案可以帮助将来的任何人 The mistake I made was an easy one. I made a mistake in placing ...相关文章
更多- Hadoop 应用总结
- Hadoop应用笔记-文件新增、删除
- Pro Hadoop
- Hadoop的FileSystem 文件系统实现上传下载文件
- [转]用Hadoop,还是不用Hadoop?
- Lucene hadoop
- Hadoop 出现SafeModeException
- Hadoop介绍
- Hadoop概述
- Hadoop Streaming
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。