Apache commons dependency issue
See original GitHub issueExpected 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:
- Created 4 years ago
- Comments:6
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had same error.
I solved this problem by using a package which is
commons-collections4-4.1.jar
.And, I got two other errors, like below.
Hope it helps you solve your problem.
Thanks @fwani for your help!