question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.NoSuchMethodError: org.apache.avro.generic.GenericData.createDatumWriter

See original GitHub issue

Hi1

I am using spark-redshift to save dataframe into redshift but facing following exception.

java.lang.NoSuchMethodError: org.apache.avro.generic.GenericData.createDatumWriter(Lorg/apache/avro/Schema;)Lorg/apache/avro/io/DatumWriter;
        at org.apache.avro.mapreduce.AvroKeyRecordWriter.<init>(AvroKeyRecordWriter.java:55)
        at org.apache.avro.mapreduce.AvroKeyOutputFormat$RecordWriterFactory.create(AvroKeyOutputFormat.java:79)
        at org.apache.avro.mapreduce.AvroKeyOutputFormat.getRecordWriter(AvroKeyOutputFormat.java:105)
        at com.databricks.spark.avro.AvroOutputWriter.<init>(AvroOutputWriter.scala:82)
        at com.databricks.spark.avro.AvroOutputWriterFactory.newInstance(AvroOutputWriterFactory.scala:31)
        at org.apache.spark.sql.execution.datasources.DefaultWriterContainer.writeRows(WriterContainer.scala:234)
        at org.apache.spark.sql.execution.datasources.InsertIntoHadoopFsRelation$$anonfun$run$1$$anonfun$apply$mcV$sp$3.apply(InsertIntoHadoopFsRelation.scala:150)
        at org.apache.spark.sql.execution.datasources.InsertIntoHadoopFsRelation$$anonfun$run$1$$anonfun$apply$mcV$sp$3.apply(InsertIntoHadoopFsRelation.scala:150)
        at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:66)
        at org.apache.spark.scheduler.Task.run(Task.scala:88)
        at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:214)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hafizmujadidcommented, Nov 27, 2015

i am using spark-avro latest version but i am facing same issue. Spark-redshift is really pissing me off 😦

0reactions
hafizmujadidcommented, May 23, 2016

There are multiple options to do so.

  1. you can use same approach as Spark-RedShift and save your data from in S3 bucket and then run copy command using redshift jdbc driver.

  2. Use SaveAsHadoopDataSet as in following code

    val dbUrl = "jdbc:postgresql://" + endpoint + ":" + port + "/" +
    

    database + “?user=” + username + “&password=” + password val records = df.map(row => (TableRow(row.toString, columnTypes), null)) val jobConf = new JobConf() DBConfiguration.configureDB(jobConf, “org.postgresql.Driver”, dbUrl, username, password) DBOutputFormat.setOutput(jobConf, table, columns: _*) records.saveAsHadoopDataset(jobConf)

On Mon, May 23, 2016 at 12:46 AM, WillSidebottom notifications@github.com wrote:

OK, are you still writing data to Redshift from spark? If so, how are you doing it? Thanks again!

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/databricks/spark-redshift/issues/129#issuecomment-220851987

Regards: HAFIZ MUJADID

Read more comments on GitHub >

github_iconTop Results From Across the Web

[SOLVED] java.lang.NoSuchMethodError: org.apache.avro ...
[SOLVED] java.lang.NoSuchMethodError: org.apache.avro.generic.GenericData.createDatumWriter When Using Avro Data with MapReduce.
Read more >
apache - Exception in deserializing avro object in map reduce
Exception: java.lang.NoSuchMethodError: org.apache.avro.generic.GenericData.createDatumWriter(Lorg/apache/avro/Schema;)Lorg/apache/avro/io/ ...
Read more >
java.lang.NoSuchMethodError: org.apache.avro.Schema ...
Hi I am upgrading an existing application using a kafka-client + Avro schemas to the following versions: <avro.version>1.11.0</avro.version> ...
Read more >
Solved: Sqoop import of Avro file from Teradata to hdfs.
YarnChild: Error running child : java.lang.NoSuchMethodError: org.apache.avro.generic.GenericData.createDatumWriter(Lorg/apache/avro/Schema ...
Read more >
'Re: avro run error' - MARC
YarnChild: > Error running child : java.lang.NoSuchMethodError: > org.apache.avro.generic.GenericData.createDatumWriter(Lorg/apache/avro/Schema ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found