开发者

Scala eclipse plugin Problem

开发者 https://www.devze.com 2023-03-08 00:17 出处:网络
I install the scala eclipse plugin, but it make me annoyed It cannot compile correctly, it indicate compiling error for the following statement

I install the scala eclipse plugin, but it make me annoyed

It cannot compile correctly, it indicate compiling error for the following statement

job setMapperClass classOf[ASPMapReduce.Map]

type mismatch; found : java.lang.Classcom.ebay.twitch.ASPMapReduce开发者_运维百科.Map required: java.lang.Class[_ <: org.apache.hadoop.mapreduce.Mapper]

But actually ASPMapReduce.Map is really a sub class of org.apache.hadoop.mapreeuce.Mapper And I can use maven to compile it succesffuly. but eclipse always tell me the compiling error

What's wrong with the scala eclipse plugin ? BTW I use the Scala IDE 2.0.0-beta4 with Scala 2.9.0.final for Eclipse 3.6


Your question appears to have the same root cause as this one. That question spawned this ticket against Scala.

Update: This bug is fixed in Scala 2.9.1 RC2

You can workaround the problem by using Scala 2.8.1 (boo) or, silly as it seems, defining the Mapper before the Job. The following compiles:

import org.apache.hadoop._
import org.apache.hadoop.io._
import org.apache.hadoop.conf._
import org.apache.hadoop.mapreduce._

class MyMapper extends Mapper[LongWritable,Text,Text,Text] {
  override def map(key: LongWritable, value: Text, context: Mapper[LongWritable,Text,Text,Text]#Context) {
  }
}

object MyJob {
  def main(args:Array[String]) {
    val job = new Job(new Configuration())
    job.setMapperClass(classOf[MyMapper])
  }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消