관리 메뉴

행이네

Excel Upload - java.lang.NoSuchFieldError: RAW_XML_FILE_HEADER 본문

plming/Java

Excel Upload - java.lang.NoSuchFieldError: RAW_XML_FILE_HEADER

행이™ 2018. 6. 22. 10:18

Excel Upload를 처리하기 위해서

Apache POI - Download Release Artifacts : http://poi.apache.org/download.html

현재의 최신버전 3.17 사용했었.

 

poi-3.17.jar
poi-ooxml-3.17.jar
poi-ooxml-schemas-3.17.jar

 

※ Excel Upload를 처리하기 위해

   추가로 cos.jar, commons-collections4-4.1.jar, xmlbeans-2.6.0.jar 파일이 더 필요하다.

 

Windows 개발환경에서는 잘 되었으나

 

Ubuntu 에서는

아래와 같은 Exception을 맞았다.

 

 java.lang.NoSuchFieldError: RAW_XML_FILE_HEADER
    org.apache.poi.poifs.filesystem.FileMagic.<clinit>(FileMagic.java:42)
    org.apache.poi.openxml4j.opc.internal.ZipHelper.verifyZipHeader(ZipHelper.java:174)
    org.apache.poi.openxml4j.opc.internal.ZipHelper.openZipFile(ZipHelper.java:237)
    org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:134)
    org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:117)
    org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:257)
    org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:187)
    org.apache.poi.POIXMLDocument.openPackage(POIXMLDocument.java:89)
    org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:340)
    org.apache.jsp.excel_005fupload_jsp.getExcel(excel_005fupload_jsp.java:48)
    org.apache.jsp.excel_005fupload_jsp._jspService(excel_005fupload_jsp.java:599)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

 

 

버전 3.16 사용했더니...

 

poi-3.16.jar
poi-ooxml-3.16.jar
poi-ooxml-schemas-3.16.jar

 

또 다른 Trace로 Exception을 맞았다.

 

 java.lang.NoSuchFieldError: RAW_XML_FILE_HEADER
    org.apache.poi.openxml4j.opc.internal.ZipHelper.verifyZipHeader(ZipHelper.java:192)
    org.apache.poi.openxml4j.opc.internal.ZipHelper.openZipFile(ZipHelper.java:269)
    org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:134)
    org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:117)
    org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:257)
    org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:187)
    org.apache.poi.POIXMLDocument.openPackage(POIXMLDocument.java:90)
    org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:336)
    org.apache.jsp.excel_005fupload_jsp.getExcel(excel_005fupload_jsp.java:48)
    org.apache.jsp.excel_005fupload_jsp._jspService(excel_005fupload_jsp.java:599)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

 

 

이리 저리 검색하다...

버전 3.13 을 사용했더니 성공~

 

poi-3.13.jar
poi-ooxml-3.13.jar
poi-ooxml-schemas-3.13.jar

 

※ jar 파일 다운로드

https://repo1.maven.org/maven2/org/apache/poi/poi/3.13/

https://repo1.maven.org/maven2/org/apache/poi/poi-ooxml/3.13/

https://repo1.maven.org/maven2/org/apache/poi/poi-ooxml-schemas/3.13/

 

 

0 Comments
댓글쓰기 폼