import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class ReadExcel{
public String Readxlsx(File f){
String str;
InputStream fis =new FileInputStream(f);
XSSFWorkbook wb = new XSSFWorkbook(fis); //到这句出错
……
return str;
}
}
错误信息:严重: Servlet.service() for servlet [springDispatcherServlet] in context with path [/mfile] threw exception [Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org/apache/poi/UnsupportedFileFormatException] with root cause
java.lang.Cla
JAVA POI 读取2013 EXCEL时 XSSFWorkbook(fis);出错
最新推荐文章于 2022-07-17 22:33:31 发布
在使用Java的POI库处理2013 Excel文件时遇到错误,具体为`NoClassDefFoundError: org/apache/poi/UnsupportedFileFormatException`。问题根源在于缺少或版本不匹配的jar包。解决方法是确保导入所有必需的POI库,并保持版本一致,无需特定版本限制。
摘要由CSDN通过智能技术生成