I am struggling to read excel file in a dynamic web project I am developing. I could easily read it in a java application by following the same steps.
What I did?
I added these to build path
Code:
FileInputStream input_document = new FileInputStream(new File("file_location"));
XSSFWorkbook my_xls_workbook = new XSSFWorkbook(input_document);
XSSFSheet my_worksheet = my_xls_workbook.getSheetAt(0);
XSSFCell cell=null;
for(int i=0;i<463;i++){
cell = my_worksheet.getRow(i).getCell(0);
words[i]=cell.getStringCellValue();
System.out.println(words[i]);
}
my_xls_workbook.close();
The Error
SEVERE: StandardWrapper.Throwable
java.lang.NoClassDefFoundError: org/apache/poi/xssf/usermodel/XSSFWorkbook
org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet vhealth.GetMed
java.lang.ClassNotFoundException: org.apache.poi.xssf.usermodel.XSSFWorkbook
It is pretty long but this is the gist of it
The Question
I want to know how to solve this and as I mentioned it works in another similar java file after following the same steps. I want to integrate it in the web app. I've also tried calling the routine which imports the database in Java from the WebApp(which uses tomcat if that helps) still no luck.
You need to add jar files not only in the build path. You need obviously to have the same files in your war module in the WEB-INF/lib folder.
P.S. I think you don't need poi-examples jar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With