首页 \ 问答 \ 在oozie工作中得到错误(getting error in oozie job)

在oozie工作中得到错误(getting error in oozie job)

我有一个WordCount MapReduce作业,当它从hadoop cli运行时它运行良好并给出输出。 但是当我通过oozie运行这个工作时它会让我犯错误'错误:java.io.IOException:键入地图中的键不匹配:期望org.apache.hadoop.io.Text,收到org.apache.hadoop.io.LongWritable'

这是代码

package Drivers;

import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

public class WordCount extends Configured implements Tool
{

    public static void main(String[] args) throws Exception 
    {
    int res = ToolRunner.run(new Configuration(), new WordCount(), args);
    System.exit(res);
    }

    @Override
    public int run(String[] args) throws Exception 
    {

    Job job = Job.getInstance(getConf(), "Tool Job");
    job.setJarByClass(WordCount.class);
    job.setMapperClass(WordMap.class);
    job.setReducerClass(RedForSum.class);
    job.setMapOutputKeyClass(Text.class);
    job.setMapOutputValueClass(IntWritable.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(IntWritable.class);
    FileInputFormat.addInputPath(job, new Path(args[0]));
    FileOutputFormat.setOutputPath(job, new Path(args[1]));
    return job.waitForCompletion(true) ? 0 : 1;
    }


    //map method
    public static class WordMap extends Mapper<LongWritable,Text,Text,IntWritable>
    {
        public void map(LongWritable k, Text v,Context con) throws IOException, InterruptedException
        {
            String line=v.toString();
            StringTokenizer t = new StringTokenizer(line);
            while(t.hasMoreTokens())
            {
                String word=t.nextToken();
                con.write(new Text(word),new IntWritable(1));
            }

        }
    }
    //reducer method
    public static class RedForSum extends Reducer<Text, IntWritable,Text,IntWritable>
    {
        public void reduce(Text k, Iterable<IntWritable> vlist, Context con) throws IOException, InterruptedException
        {
            int tot=0;
            for(IntWritable v:vlist)
             tot+=v.get();
            con.write(k, new IntWritable(tot));
        }
    }
}

我的workflow.xml在这里

    <workflow-app xmlns="uri:oozie:workflow:0.1" name="map-reduce-wf">
 <start to="mr-node"/>
 <action name="mr-node">
     <map-reduce>
       <job-tracker>${jobTracker}</job-tracker>
       <name-node>${nameNode}</name-node>
   <configuration>
     <property>
       <name>mapred.mapper.new-api</name>
       <value>true</value>
     </property>
     <property>
       <name>mapred.reducer.new-api</name>
       <value>true</value>
     </property>
     <property>
       <name>mapred.job.queue.name</name>
       <value>${queueName}</value>
     </property>
     <property>
       <name>mapreduce.mapper.class</name>
       <value>Drivers.WordCount$WordMap</value>
     </property>
     <property>
       <name>mapreduce.reducer.class</name>
       <value>Drivers.WordCount$RedForSum</value>
     </property>
     <property>
       <name>mapred.output.key.class</name>
       <value>org.apache.hadoop.io.Text</value>
     </property>
     <property>
       <name>mapred.output.value.class</name>
       <value>org.apache.hadoop.io.IntWritable</value>
     </property>
     <property>
       <name>mapred.input.dir</name>
       <value>${inputDir}</value>
     </property>
     <property>
       <name>mapred.output.dir</name>
       <value>${outputDir}</value>
     </property>
   </configuration>
  </map-reduce>
  <ok to="end"/>
  <error to="fail"/>
 </action>
   <kill name="fail">
   <message>Map/Reduce failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
   </kill>
   <end name="end"/>
</workflow-app>

当我经历oozie

oozie job -oozie http://localhost:11000/oozie -config /home/cloudera/job.properties -run

它给我带来了错误

错误:java.io.IOException:键入map中的键不匹配:期望org.apache.hadoop.io.Text,在org.apache.hadoop.mapred.MapTask收到org.apache.hadoop.io.LongWritable $ MapOutputBuffer.collect (MapTask.java:1072)org.apache.hadoop.mapred.MapTask $ NewOutputCollector.write(MapTask.java:715)at org.apache.hadoop.mapreduce.task.TaskInputOutputContextImpl.write(TaskInputOutputContextImpl.java:89)at at org.apache.hadoop.mapreduce.lib.map.WrappedMapper $ Context.write(WrappedMapper.java:112)位于org.apache.hadoop的org.apache.hadoop.mapreduce.Mapper.map(Mapper.java:124)。 map.uceper.run(Mapper.java:145)org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787)org.apache.hadoop.mapred.MapTask.run(MapTask.java:341) at org.apache.hadoop.mapred.YarnChild $ 2.run(YarnChild.java:163)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:167 1)在org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)

有人可以让我知道我错在哪里。

提前致谢。


I have a WordCount MapReduce job, when it runs from hadoop cli it runs well and given the output. but when I run the job through oozie it throwing me error 'Error: java.io.IOException: Type mismatch in key from map: expected org.apache.hadoop.io.Text, received org.apache.hadoop.io.LongWritable'

Here is the code

package Drivers;

import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

public class WordCount extends Configured implements Tool
{

    public static void main(String[] args) throws Exception 
    {
    int res = ToolRunner.run(new Configuration(), new WordCount(), args);
    System.exit(res);
    }

    @Override
    public int run(String[] args) throws Exception 
    {

    Job job = Job.getInstance(getConf(), "Tool Job");
    job.setJarByClass(WordCount.class);
    job.setMapperClass(WordMap.class);
    job.setReducerClass(RedForSum.class);
    job.setMapOutputKeyClass(Text.class);
    job.setMapOutputValueClass(IntWritable.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(IntWritable.class);
    FileInputFormat.addInputPath(job, new Path(args[0]));
    FileOutputFormat.setOutputPath(job, new Path(args[1]));
    return job.waitForCompletion(true) ? 0 : 1;
    }


    //map method
    public static class WordMap extends Mapper<LongWritable,Text,Text,IntWritable>
    {
        public void map(LongWritable k, Text v,Context con) throws IOException, InterruptedException
        {
            String line=v.toString();
            StringTokenizer t = new StringTokenizer(line);
            while(t.hasMoreTokens())
            {
                String word=t.nextToken();
                con.write(new Text(word),new IntWritable(1));
            }

        }
    }
    //reducer method
    public static class RedForSum extends Reducer<Text, IntWritable,Text,IntWritable>
    {
        public void reduce(Text k, Iterable<IntWritable> vlist, Context con) throws IOException, InterruptedException
        {
            int tot=0;
            for(IntWritable v:vlist)
             tot+=v.get();
            con.write(k, new IntWritable(tot));
        }
    }
}

my workflow.xml is here

    <workflow-app xmlns="uri:oozie:workflow:0.1" name="map-reduce-wf">
 <start to="mr-node"/>
 <action name="mr-node">
     <map-reduce>
       <job-tracker>${jobTracker}</job-tracker>
       <name-node>${nameNode}</name-node>
   <configuration>
     <property>
       <name>mapred.mapper.new-api</name>
       <value>true</value>
     </property>
     <property>
       <name>mapred.reducer.new-api</name>
       <value>true</value>
     </property>
     <property>
       <name>mapred.job.queue.name</name>
       <value>${queueName}</value>
     </property>
     <property>
       <name>mapreduce.mapper.class</name>
       <value>Drivers.WordCount$WordMap</value>
     </property>
     <property>
       <name>mapreduce.reducer.class</name>
       <value>Drivers.WordCount$RedForSum</value>
     </property>
     <property>
       <name>mapred.output.key.class</name>
       <value>org.apache.hadoop.io.Text</value>
     </property>
     <property>
       <name>mapred.output.value.class</name>
       <value>org.apache.hadoop.io.IntWritable</value>
     </property>
     <property>
       <name>mapred.input.dir</name>
       <value>${inputDir}</value>
     </property>
     <property>
       <name>mapred.output.dir</name>
       <value>${outputDir}</value>
     </property>
   </configuration>
  </map-reduce>
  <ok to="end"/>
  <error to="fail"/>
 </action>
   <kill name="fail">
   <message>Map/Reduce failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
   </kill>
   <end name="end"/>
</workflow-app>

When I run through oozie

oozie job -oozie http://localhost:11000/oozie -config /home/cloudera/job.properties -run

it throwing me the error

Error: java.io.IOException: Type mismatch in key from map: expected org.apache.hadoop.io.Text, received org.apache.hadoop.io.LongWritable at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:1072) at org.apache.hadoop.mapred.MapTask$NewOutputCollector.write(MapTask.java:715) at org.apache.hadoop.mapreduce.task.TaskInputOutputContextImpl.write(TaskInputOutputContextImpl.java:89) at org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.write(WrappedMapper.java:112) at org.apache.hadoop.mapreduce.Mapper.map(Mapper.java:124) at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163) 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:1671) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)

Can someone please let me know where I was mistaken.

Thanks in Advance.


原文:https://stackoverflow.com/questions/36514102
更新时间:2023-10-25 13:10

最满意答案

这里说:

/// Data type for NETGEN mesh
typedef void * Ng_Mesh;

因此Ng_Mesh* mesh;void** mesh;相同void** mesh;


Here it says:

/// Data type for NETGEN mesh
typedef void * Ng_Mesh;

therefore Ng_Mesh* mesh; is the same as void** mesh;

相关问答

更多
  • 这里有几个问题: 1) std::move不会移动,特别是如果你传递const && 。 在这里和这里看到答案。 2)我所知道的每个std::string实现都使用小缓冲区优化。 当使用短字符串(例如"one" )构造时,这样的实现永远不会分配。 3)允许标准库运行时在静态初始化期间调用operator new ,例如设置std::cout 。 您看到的分配很可能与string构造函数或(缺少)移动无关。 There are several issues here: 1) std::move does no ...
  • 我注意到存储在ptr中的地址总是被00008123覆盖... 这似乎很奇怪,所以我做了一点挖掘,发现这篇Microsoft博客文章包含一个讨论“删除C ++对象时自动指针清理”的部分。 ...检查NULL是一个常见的代码构造,意味着现有的NULL检查结合使用NULL作为消毒值可能会偶然隐藏真正的内存安全问题,其根本原因确实需要寻址。 为此,我们选择了0x8123作为一个消毒值 - 从操作系统的角度看,这与零地址(NULL)在同一个内存页面中,但0x8123的访问冲突将更加突出,需要更多的细节关注。 它不仅解 ...
  • 您需要提供正确的连接字符串 string connectionString = "data source=.\SQLEXPRESS;initial catalog=student;integrated security=True;"; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); MessageBox.Show("You a ...
  • free_img()是一个函数,它在.cpp文件中定义,你没有包含在项目中,或者它是在你没有链接的DLL或静态库中。 如果是前者,则需要在源文件中搜索该函数,然后将该.cpp文件添加到项目中。 如果是后者,那么您需要确定哪个库提供了free_img(),然后找到该库的.lib文件。 然后你可以这样做: 在开发环境中将.lib文件添加为链接器输入 打开项目的“属性页”对话框。 有关详细信息,请参阅设置Visual C ++项目属性。 单击“链接器”文件夹。 单击“输入”属性页。 修改Additional De ...
  • 我假设你的MyMethod像这样继续: public void MyMethod() { object[] generatorOutput = Generator.Generate(args); aList = (MyList)generatorOutput[0]; bList = (MyList)generatorOutput[1]; // ... var bList = new MyList(); // <--- I assume tha ...
  • 已安装产品: Microsoft Visual Studio 2008版本9.0.30729.1 SP Microsoft .NET Framework版本3.5 SP1 已安装版本:IDE标准版 Microsoft Visual Studio 2008 Shell的修补程序(集成模式) - ENU(KB945282)KB945282此修补程序适用于Microsoft Visual Studio 2008 Shell(集成模式) - ENU。 如果以后安装更新的Service Pack,将自动卸载此修补程序 ...
  • 第一个选项在Visual Studio的调试器的控制下启动程序。 第二个选项启动程序独立。 调试过程时的一些实际差异是: 您可以从Visual Studio暂停,恢复,停止和重新启动已调试的进程。 代码中定义的断点对于已调试的进程将处于活动状态,并且只要进程遇到其中一个进程,调试器就会暂停进程并显示堆栈跟踪。 如果不停止调试过程,则无法退出Visual Studio。 当调试的控制台进程退出时,它将显示终止消息,直到您按下某个键。 这允许您检查刚刚结束的进程的输出,而不会立即消失控制台窗口。 The fir ...
  • 这里说: /// Data type for NETGEN mesh typedef void * Ng_Mesh; 因此Ng_Mesh* mesh; 与void** mesh;相同void** mesh; Here it says: /// Data type for NETGEN mesh typedef void * Ng_Mesh; therefore Ng_Mesh* mesh; is the same as void** mesh;
  • 您可以使用Visual Studio将应用程序开发/定位到3.5框架。 Visual Studio 2010当然可以提供更好的开发体验。 以下是我要强调的那些项目以证明切换的合理性: 更好的TFS 2010集成 更好的字体渲染 开始页面改进(固定项目,没有更多无用的RSS源) 更轻松地转向超越.NET 3.5 大大提高了可扩展性和Visual Studio Gallery集成 You can develop/target your applications to the 3.5 framework with ...
  • Visual Studio Code使用Roslyn平台(参见此处 )。 与Visual Studio 2015相同。在Linux和OS X上使用Mono编译器。 IDE本身如果基本上是GitHub Atom的扩展(这很棒),当然,它甚至不会接近完整Visual Studio的强大功能。 但它非常干净,易于使用。 特别是新的ASP.NET 5 Web应用程序非常像Node.js / Angular / etc应用程序,许多人在Sublime和Atom等简单的编辑器中编写这些应用程序。 更新: 它周围的工具并 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)