본문 바로가기

개발중/troubleshooting

org.apache.poi.poifs.filesystem.OfficeXmlFileException 에러 해결

728x90
반응형

POI 를 사용해서 액셀 문서    싱   할 때 발생할 수 있는 에러

 

org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF)
at org.apache.poi.poifs.storage.HeaderBlock.<init>(HeaderBlock.java:130)
at org.apache.poi.poifs.storage.HeaderBlock.<init>(HeaderBlock.java:117)
at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:294)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:401)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:382)
at com.rsn.POMS.api.dictionary.pattern.waiting.service.PatternWaitingExceelService.getPattern(PatternWaitingExceelService.java:49)
at com.rsn.POMS.api.dictionary.pattern.waiting.service.PatternWaitingExceelService.excelUploadByPattern(PatternWaitingExceelService.java:25)
at com.rsn.POMS.api.dictionary.pattern.waiting.controller.PatternWaitingController.excelUploadByPattern(PatternWaitingController.java:60)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invo

 

 

xlsx 파일을 HSSFWorkbook 을 사용해서 파싱할 경우 에러 발생

 

XSSFWorkbook 로 파싱하면 에러 해결 !

 


 

728x90
반응형