網站首頁 編程語言 正文
記一次使用EasyExcel出現Convert excel format exception.You can try specifying the ‘excelType‘ yourself
作者:杜小舟 更新時間: 2022-08-05 編程語言EasyExcel 3.0 出現 com.alibaba.excel.exception.ExcelCommonException: Convert excel format exception.You can try specifying the ‘excelType’ yourself
這里貼一下錯誤日志
com.alibaba.excel.exception.ExcelCommonException: Convert excel format exception.You can try specifying the 'excelType' yourself
at com.alibaba.excel.support.ExcelTypeEnum.valueOf(ExcelTypeEnum.java:89) ~[easyexcel-core-3.1.0.jar!/:na]
at com.alibaba.excel.analysis.ExcelAnalyserImpl.choiceExcelExecutor(ExcelAnalyserImpl.java:66) ~[easyexcel-core-3.1.0.jar!/:na]
at com.alibaba.excel.analysis.ExcelAnalyserImpl.<init>(ExcelAnalyserImpl.java:55) ~[easyexcel-core-3.1.0.jar!/:na]
at com.alibaba.excel.ExcelReader.<init>(ExcelReader.java:27) ~[easyexcel-core-3.1.0.jar!/:na]
at com.alibaba.excel.read.builder.ExcelReaderBuilder.build(ExcelReaderBuilder.java:202) ~[easyexcel-core-3.1.0.jar!/:na]
at com.alibaba.excel.read.builder.ExcelReaderBuilder.sheet(ExcelReaderBuilder.java:239) ~[easyexcel-core-3.1.0.jar!/:na]
at com.alibaba.excel.read.builder.ExcelReaderBuilder.sheet(ExcelReaderBuilder.java:227) ~[easyexcel-core-3.1.0.jar!/:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_292]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_292]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_292]
原因:
是因為沒有找到給定路徑下的文件,檢查一下你讀取的文件路徑是否正確
我在讀取文件時,代碼這樣寫的:
// 讀取的excel文件路徑
final String excelFileName = FILE + "\\excel\\" + packageName + "\\" + excelName + ".xlsx";
我們的測試服務器是Windows,正式服務器是Linux,而我在代碼中讀取文件時使用的是 \\ 表示訪問目錄路徑,在Windows服務器中是可以使用 \\ 訪問目錄路徑,而在Linux中則是需要使用 \ 訪問目錄路徑,所以在Linux服務器中通過 \\ 進行訪問目錄路徑時沒有找到這個目錄下的這個文件,在Linux服務器中使用 / 訪問目錄路徑就可以了。
原文鏈接:https://blog.csdn.net/weixin_43657300/article/details/126133660
相關推薦
- 2023-01-11 pytorch中如何設置隨機種子_python
- 2022-01-27 editor.md第一行解析失敗,解析成代碼模塊原始輸出
- 2022-08-04 Python使用RPC例子_python
- 2024-01-13 Maven項目導入第三方jar包
- 2022-12-07 C++11,?14,?17對tuple元素的訪問詳情_C 語言
- 2022-08-10 Python靜態Web服務器面向對象處理客戶端請求_python
- 2022-05-14 Python實現屏幕代碼雨效果的示例代碼_python
- 2022-05-19 徹底解決No?module?named?‘torch_geometric‘報錯的辦法_python
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支