Classpath issues with 4.0.0

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Classpath issues with 4.0.0

David P. Caldwell
I attempted to upgrade my POI installation from 3.15 to 4.0.0, but my
software now fails with a ClassNotFoundException -- specifically, it
cannot find:

java.lang.NoClassDefFoundError:
org/apache/commons/compress/archivers/zip/ZipFile
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:298)
at org.apache.poi.ooxml.util.PackageHelper.open(PackageHelper.java:37)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:307)

The way my software attempts to embed the POI libraries is:

1. Download the distribution and unzip it,
2. Put every .jar in the lib/ directory in the classpath,
3. Put every .jar in the ooxml-lib directory in the classpath,
4. Put every .jar in the top-level directory in the classpath.

I then updated to 3.17 and this worked fine. So the breaking change
(for my code) is between 3.17 and 4.0.0.

Am I doing this right? I haven't yet started searching through the JAR
files for this class and its dependencies. I do notice that the 3.17
distribution seems to contain quite different JAR files than the 4.0.0
distribution (which contains JAXB, Java Activation Framework and so
forth), so I am guessing there was some rearchitecting of dependencies
and either there's something missing or I have to reorganize my code
loading strategy above.

Any ideas?

- David P. Caldwell
http://www.davidpcaldwell.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Classpath issues with 4.0.0

kiwiwings
Hi David,

this will be fixed be 4.0.1 - specifically this was fixed by #62742
(https://bz.apache.org/bugzilla/show_bug.cgi?id=62742)

Please add Commons Compress 1.18 (or higher) to your classpath.
https://search.maven.org/artifact/org.apache.commons/commons-compress/1.18/jar

> The way my software attempts to embed the POI libraries is: ...
The collection seems to be ok, but you don't need the poi-examples-4.0.0.jar and probably also not the poi-excelant-4.0.0.jar.
Have a look at http://poi.apache.org/components/index.html#components for more infos.
Have you thought about using a package manager like maven or gradle?
... I would then try to add the dependency to poi-ooxml and if it fails for your usecase another to poi-scratchpad

> so I am guessing there was some rearchitecting of dependencies
Yes, hence also the version jump from 3.x to 4.x

Andi


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]