0
votes

I added the jar files of apache poi to the build path of my project but still have an error when trying XWPFDocument docx = new XWPFDocument(new FileInputStream(folderName + fileName));

I tried to add the jar files of different versions of Apache POI but nothing worked. Without the JSP environment my programs works.

This is my code: XWPFDocument docx = new XWPFDocument(new FileInputStream(folderName + fileName));

This is my error message: org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [jsp] in context with path [/MYPACKAGENAME] threw exception [javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/poi/xwpf/usermodel/XWPFDocument] with root cause

Thank you in advance.

2

2 Answers

0
votes

I could fix the problem by adding the Apache POI jars to the TomCat class path in Eclipse (see class path): https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.stardust.docs.wst%2Fhtml%2Fwst-integration%2Fconfiguration.html

0
votes

If the jar was not physically placed into the WEB-INF/lib folder, you will need to go to the project's Deployment Assembly property page (right-click on the project->Properties) and set the jar to be deployed.