Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6389197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:22:24+00:00 2026-05-25T03:22:24+00:00

I am unable to fix these typechecking errors in Scala: package junk import org.apache.hadoop.conf.Configuration

  • 0

I am unable to fix these typechecking errors in Scala:

package junk

import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.io.IntWritable
import org.apache.hadoop.io.Text
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat
import org.apache.hadoop.mapreduce.Job

object Sample {
  val conf: Configuration = new Configuration()
  val job: Job = new Job(conf, "sample Hadoop MapReduce program");

  job.setInputFormatClass(classOf[TextInputFormat])
  job.setOutputFormatClass(classOf[TextOutputFormat])
  job.setOutputFormatClass(classOf[TextOutputFormat[Text, IntWritable]])
}    

The error messages are

Sample.scala:14: error: type mismatch;
found   : java.lang.Class[org.apache.hadoop.mapreduce.lib.input.TextInputFormat](classOf[org.apache.hadoop.mapreduce.lib.input.TextInputFormat])
required: java.lang.Class[_ <: org.apache.hadoop.mapreduce.InputFormat]
 job.setInputFormatClass(classOf[TextInputFormat])
                                ^
Sample.scala:15: error: class TextOutputFormat takes type parameters
 job.setOutputFormatClass(classOf[TextOutputFormat])
                                  ^
Sample.scala:16: error: type mismatch;
found   : java.lang.Class[org.apache.hadoop.mapreduce.lib.output.TextOutputFormat[org.apache.hadoop.io.Text,org.apache.hadoop.io.IntWritable]](classOf[org.apache.hadoop.mapreduce.lib.output.TextOutputFormat])
required: java.lang.Class[_ <: org.apache.hadoop.mapreduce.OutputFormat]
 job.setOutputFormatClass(classOf[TextOutputFormat[Text, IntWritable]])

Note that I have tried to setOutputFormatClass in two different ways and both fail.

I am trying to write Hadoop WordCount: http://wiki.apache.org/hadoop/WordCount in Scala. The equivalent lines in Java are

job.setInputFormatClass(TextInputFormat.class);
job.setOutputFormatClass(TextOutputFormat.class);

API docs for Job: http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/mapreduce/Job.html

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:22:25+00:00Added an answer on May 25, 2026 at 3:22 am

    As of Scala 2.9.1 (not Scala 2.9.0 — see https://issues.scala-lang.org/browse/SI-4603), this also works:

    job.setInputFormatClass(classOf[TextInputFormat])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been unable to build P4Python for an Intel Mac OS X 10.5.5. These
I am unable to get the borders of these td's to follow their rows
Is there a full specification for pattern matching possibilities of Scala? I am unable
I am using android 2.2 and if I run my project these errors occur.
Very recently I've asked this question, but wasn unable to fix this. So I
Often PHP is unable to import RSS feeds because they either contain invalid characters,
Unable to find a SQL diff tool that meets my needs, I am writing
Error: Unable to read data from the transport connection: A blocking operation was interrupted
I am unable to consume messages sent via ActiveMQ from my Flex client. Sending
I have been unable to receive UDP multicast under VxWorks 5.5. I've joined the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.