导入excel时出错:无法初始化org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller类(示例

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了导入excel时出错:无法初始化org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller类(示例相关的知识,希望对你有一定的参考价值。

我在使用apache poi导入excel文件时遇到问题。我的应用程序在UAT环境中成功运行,但在生产环境中出现错误:

[4/17/20 18:12:36:597 ICT] 00003b2f ServletWrappe E com.ibm.ws.webcontainer.servlet.ServletWrapper service Uncaught service() exception thrown by servlet FileImportData: java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller
    at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:161)
    at org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:141)
    at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:97)
    at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:324)
    at org.apache.poi.util.PackageHelper.open(PackageHelper.java:37)
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:295)
    at com.bidv.qlcsdlsibs.v2.servlet.FileImportData.doPost(FileImportData.java:87)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:79)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:960)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1064)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3837)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:981)
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)
    at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:88)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:558)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:608)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:985)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1074)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1864)

我认为问题出在网上:

Workbook workbook = new XSSFWorkbook(fileInputStream);
Sheet sheet = workbook.getSheetAt(0);

我正在使用lib:poi-3.17.jar,poi-ooxml-3.17.jar,ooxml-schemas-1.3.jar我使用Java 1.7在IBM Websphere Portal 8.5.5.2(包括UAT和生产)上部署了应用程序。请查看我的lib文件夹

enter image description here

答案

我通过选择另一个Java运行时环境(选择IBM Websphere的JRE而不是使用另一个JRE)解决了我的问题,以构建项目。谢谢!

以上是关于导入excel时出错:无法初始化org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller类(示例的主要内容,如果未能解决你的问题,请参考以下文章

通过 Aginity Workbench for Netezza 导入 excel 文件时出错

SQL Server 2005导入数据时出错,导入的是TXT文本格式

SQL Server2014 任务导入数据导入Excel表操作无法完成

将Excel文件导入网格视图时出错

处理#Num!将 Excel 导入 Access 时出错

尝试将数据从 Excel 导入 SQL 表时出错