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.

Dependency Issue java.lang.NoSuchMethodError: com.monitorjbl.xlsx

See original GitHub issue

Hello, i’m trying to read a simple excel file but i keep getting an error. Here is the full stacktrace

Exception in thread "main" java.lang.NoSuchMethodError: com.monitorjbl.xlsx.StreamingReader$Builder.open(Ljava/io/InputStream;)Lshadeio/poi/ss/usermodel/Workbook; at com.crealytics.spark.excel.StreamingWorkbookReader.openWorkbook(WorkbookReader.scala:56) at com.crealytics.spark.excel.WorkbookReader.withWorkbook(WorkbookReader.scala:14) at com.crealytics.spark.excel.WorkbookReader.withWorkbook$(WorkbookReader.scala:13) at com.crealytics.spark.excel.StreamingWorkbookReader.withWorkbook(WorkbookReader.scala:47) at com.crealytics.spark.excel.ExcelRelation.excerpt$lzycompute(ExcelRelation.scala:31) at com.crealytics.spark.excel.ExcelRelation.excerpt(ExcelRelation.scala:31) at com.crealytics.spark.excel.ExcelRelation.headerCells$lzycompute(ExcelRelation.scala:33) at com.crealytics.spark.excel.ExcelRelation.headerCells(ExcelRelation.scala:33) at com.crealytics.spark.excel.ExcelRelation.$anonfun$inferSchema$1(ExcelRelation.scala:148) at scala.Option.getOrElse(Option.scala:138) at com.crealytics.spark.excel.ExcelRelation.inferSchema(ExcelRelation.scala:147) at com.crealytics.spark.excel.ExcelRelation.<init>(ExcelRelation.scala:40) at com.crealytics.spark.excel.DefaultSource.createRelation(DefaultSource.scala:40) at com.crealytics.spark.excel.DefaultSource.createRelation(DefaultSource.scala:18) at com.crealytics.spark.excel.DefaultSource.createRelation(DefaultSource.scala:12) at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:318) at org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:223) at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:211) at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:178) at ExcelSparkParser$.readExcel(ExcelSparkParser.scala:86) at ExcelSparkParser$.$anonfun$main$3(ExcelSparkParser.scala:51) at ExcelSparkParser$.$anonfun$main$3$adapted(ExcelSparkParser.scala:48) at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36) at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33) at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:198) at ExcelSparkParser$.main(ExcelSparkParser.scala:48) at ExcelSparkParser.main(ExcelSparkParser.scala)

Envirorment:

  • Scala 2.12.8 (tested also 2.12.0)
  • Spark Core/SQL/Avro 2.4.0 (also tested on 2.4.3)
  • Spark excel 0.12.0
  • Running locally on my machine

I’m able to make it work only using an older version of spark-excel, to be precise version 0.11.2 , same spark versione and same scala version. scala 2.11.x and spark-excel 0.11.1 are also working.

Thank you very much

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:23

github_iconTop GitHub Comments

3reactions
wdorningercommented, Oct 17, 2019

I get the same error. When using the option maxRowsInMemory you get the above error. When removing that option the dependency error disappears.

I’m new to spark-excel so maybe not entirely accurate but that was my observation.

import org.apache.spark.sql.SparkSession
import com.crealytics.spark.excel._

object ExcelApp {
  def main(args: Array[String]) {

    val spark = SparkSession.builder
      .appName("SparkExcel")
      .master("local[2]")
      .getOrCreate

    val df = spark.read.excel(
      useHeader = true,  
      maxRowsInMemory = 20
    ).load("C:\\Temp\\excel-fun.xlsx")

    df.show()
  }
}

Exception in thread “main” java.lang.NoSuchMethodError: com.monitorjbl.xlsx.StreamingReader$Builder.open(Ljava/io/InputStream;)Lshadeio/poi/ss/usermodel/Workbook;

1reaction
nightscapecommented, Dec 30, 2019

I’ve released 0.12.4 with xlsx-streamer shaded. This should hopefully fix this issue. If it doesn’t, please reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.NoClassDefFoundError: Could not initialize class ...
Dependency mediation - this determines what version of a dependency will be used when multiple versions of an artifact are encountered.
Read more >
[Solved]-kotlin android get deleted value from realm-java-kotlin
How to get value from range slider on every change in android studio? java.lang.NoSuchMethodError in external java dependency inside the java dependency ......
Read more >
Error when using a java action
I get the following error when trying to pass a .xlsx file through a string extract java action. java.lang.NoSuchMethodError: ...
Read more >
excel-streaming-reader
Removal of poi-ooxml from excel-streaming-reader dependency list should have no ... java.lang. ... NullPointerException at com.monitorjbl.xlsx.impl.
Read more >
com.monitorjbl : xlsx-streamer : 2.1.0 - Maven Central
[![Maven Central](https://img.shields.io/maven-central/v/com.monitorjbl/xlsx-streamer.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com ...
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