poi解析excel文件报错

getFileMagic() only operates on streams which support mark(int)

使用 bis 解决

        BufferedInputStream bis = new BufferedInputStream(new FileInputStream(new File(path)));
        XSSFWorkbook xssfWorkbook = new XSSFWorkbook(bis);

找不到类,一般是版本问题,可以把版本调整一致,3.15
java.lang.reflect.InvocationTargetException
org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException

Java.lang.NoClassDefFoundError :org/openxmlformats/schemas/spreadsheetml/x2006/main/ctextensionlist

pom配置,版本保持一致,3.15

        
            org.apache.poi
            poi
            3.15
        
        
            org.apache.poi
            poi-scratchpad
            3.15
        
        
            org.apache.poi
            poi-ooxml
            3.15
        
        
            org.apache.poi
            poi-ooxml-schemas
            3.15
        

你可能感兴趣的:(poi解析excel文件报错)