Reputation: 17
I have written a program which reads input from csv file and its working fine. I read the inputstream of the csv file as follows.
BufferedReader br=new BufferedReader(new InputStreamReader(item.getInputStream()));
Now I am changing the program so as to read input from excel file. So I changed the code to this format and while compilation there are no errors.
POIFSFileSystem ps = new POIFSFileSystem(item.getInputStream());
HSSFWorkbook workbook = new HSSFWorkbook(ps);
But while submitting the JSP page, I get the following error. What must be the problem and where I have went wrong? Please advise.
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.NoClassDefFoundError: org/apache/poi/poifs/filesystem/POIFSFileSystem
Readcsvv.doPost(Readcsvv.java:120)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Upvotes: 0
Views: 5474
Reputation: 4997
Your POI jars are not in the classpath. Put them in the WEB-INF/lib folder.
Another less likely reason could be that your version of jars is different than those expected.
Upvotes: 1
Reputation: 3305
It looks like you've forgotten to include the POI library on the CLASSPATH (e.g. It's not referenced by your web app). You can include this lib under WEB-INF/lib (in your WAR archive or in the exploded directory format) or it can sit elsewhere in your app server/web server CLASSPATH
Upvotes: 0