Bug 57957 - java.lang.NoClassDefFoundError: org/apache/poi/wp/usermodel/Paragraph when using XWPFDocument
Summary: java.lang.NoClassDefFoundError: org/apache/poi/wp/usermodel/Paragraph when us...
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 blocker (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on: 57963
  Show dependency tree
Reported: 2015-05-27 19:00 UTC by Daniel Della Savia
Modified: 2015-05-28 12:20 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Della Savia 2015-05-27 19:00:17 UTC
When I'm attempt to use the class XWPFDocument to open a specific file, is return me a error message: javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/poi/wp/usermodel/Paragraph. 

Here is the line code:

XWPFDocument doc = new XWPFDocument(OPCPackage.open(MyClass.class.getResourceAsStream(fileName)));
Comment 1 Dominik Stadler 2015-05-27 20:15:26 UTC
You are likely missing the "poi-scratchpad-XXX.jar" library of POI in your classpath which holds some of the classes that are necessary for working with Word Documents.
Comment 2 Daniel Della Savia 2015-05-27 21:01:20 UTC
I'm have using maven to get the necessary libraries... in my pom.xml I have the following:


What is wrong?
Comment 3 Daniel Della Savia 2015-05-27 21:05:24 UTC
sorry, where reads



Comment 4 Dominik Stadler 2015-05-28 05:01:17 UTC
Try adding

Comment 5 Dominik Stadler 2015-05-28 05:56:19 UTC
FYI, the requirement on scratch-jar is not intended, but unfortunately made it into 3.12, newer releases will have this dependency removed again, see bug 57963 for this.
Comment 6 Daniel Della Savia 2015-05-28 12:20:22 UTC
Tks, Dominik. It works beautifully for me!