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.

Apache commons dependency issue

See original GitHub issue

Expected Behavior

I’m trying to use the library to read an excel file using the following command:

val df = spark.read.format(“com.crealytics.spark.excel”).option(“dataAddress”,“PARTA”).option(“useHeader”,“true”).load(“myfileXLSX”)

Current Behavior

I’m getting the following NoClassDefFoundError:

Caused by: java.lang.NoClassDefFoundError: org/apache/commons/collections4/IteratorUtils
  at shadeio.poi.openxml4j.util.ZipInputStreamZipEntrySource.getEntries(ZipInputStreamZipEntrySource.java:58)
  at shadeio.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:286)
  at shadeio.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:725)
  at shadeio.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:301)
  at shadeio.poi.xssf.usermodel.XSSFWorkbookFactory.createWorkbook(XSSFWorkbookFactory.java:129)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at shadeio.poi.ss.usermodel.WorkbookFactory.createWorkbook(WorkbookFactory.java:314)
  ... 80 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections4.IteratorUtils
  at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  ... 90 more

Before executing the previous command I’m importing the following:

import spark.implicits._ import com.crealytics.spark.excel._

If I don’t import spark.implicits._ I’m also getting some errors when importing the spark-excel library:

error: missing or invalid dependency detected while loading class file 'DataColumn.class'.
Could not access term poi in package org.apache,
because it (or its dependencies) are missing. Check your build definition for
missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'DataColumn.class' was compiled against an incompatible version of org.apache.
error: missing or invalid dependency detected while loading class file 'DataColumn.class'.
Could not access term ss in value org.apache.poi,
because it (or its dependencies) are missing. Check your build definition for
missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'DataColumn.class' was compiled against an incompatible version of org.apache.poi.

I’m using the version 0.12.0 of the library.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

4reactions
fwanicommented, Apr 16, 2020

I had same error.

java.io.IOException: org/apache/commons/collections4/IteratorUtils

I solved this problem by using a package which is commons-collections4-4.1.jar.

And, I got two other errors, like below.

# first error
java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlObject
# to solve, using xmlbeans-3.1.0.jar

# second error
java.lang.NoClassDefFoundError: org/openxmlformats/schemas/drawingml/x2006/main/ThemeDocument
# to solve, using poi-ooxml-schemas-4.1.2.jar

Hope it helps you solve your problem.

2reactions
AlbertFX91commented, Jul 7, 2020

Thanks @fwani for your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

maven: how to fix dependency issue in intellji - Stack Overflow
You'll just need to add the repository config: <dependencies> <dependency> <groupId>org.apache.commons</groupId> ...
Read more >
Commons Compress – Project Dependencies
The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application: ...
Read more >
Commons Configuration – Dependency Information
Dependency Information · Apache Maven · Apache Buildr · Apache Ivy · Groovy Grape · Gradle/Grails · Scala SBT · Leiningen.
Read more >
Math – Dependency Information - Apache Commons
Dependency Information · Apache Maven · Apache Buildr · Apache Ivy · Groovy Grape · Gradle/Grails · Scala SBT · Leiningen.
Read more >
Dependency Information - Apache Commons
Dependency Information · Apache Maven · Apache Buildr · Apache Ivy · Groovy Grape · Gradle/Grails · Scala SBT · Leiningen.
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