Loading

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

		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi</artifactId>
			<version>3.15</version>
		</dependency>
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi-scratchpad</artifactId>
			<version>3.15</version>
		</dependency>
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi-ooxml</artifactId>
			<version>3.15</version>
		</dependency>
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi-ooxml-schemas</artifactId>
			<version>3.15</version>
		</dependency>
posted @ 2019-04-03 16:05  遗失的拂晓  阅读(2845)  评论(0编辑  收藏  举报