开发者社区> 问答> 正文

项目中用poi,在导出的时候报错?报错

自己写Demo的时候完全正常,但是在项目中应用的时候报错了

java.lang.NoSuchMethodError: org.apache.poi.util.POILogger.log(I[Ljava/lang/Object;)V
at org.apache.poi.openxml4j.opc.ZipPackage.saveImpl(ZipPackage.java:443)
at org.apache.poi.openxml4j.opc.OPCPackage.save(OPCPackage.java:1441)
at org.apache.poi.POIXMLDocument.write(POIXMLDocument.java:212)
at cn.nin._99cj.util.BatchAddUserAction.putIntoExcel(BatchAddUserAction.java:79)
at cn.nin._99cj.util.BatchAddUserAction.execute(BatchAddUserAction.java:34)
at cn.netinnet.qdk.action.execute.CommonAction.NextActionOrForwardOrCommonactionExecute(Unknown Source)
at cn.netinnet.qdk.action.execute.TypeQuery.execute(Unknown Source)
at cn.netinnet.qdk.action.DoActionSeries.a(Unknown Source)
at cn.netinnet.qdk.action.DoActionSeries.beginToDo(Unknown Source)
at cn.netinnet.qdk.action.ActionFilter.doFilter(Unknown Source)
at com.netinnet.qdk.filter.NFilterChain.doFilter(Unknown Source)
at cn.nin._99cj.filter.BackFilter.doFilter(BackFilter.java:89)
at com.netinnet.qdk.filter.NFilterChain.doFilter(Unknown Source)
at cn.nin._99cj.filter.OrgFilter.doFilter(OrgFilter.java:73)
at com.netinnet.qdk.filter.NFilterChain.doFilter(Unknown Source)
at com.netinnet.qdk.filter.OrgFilter.doFilter(Unknown Source)
at com.netinnet.qdk.filter.NFilterChain.doFilter(Unknown Source)
at com.netinnet.qdk.filter.AuthFilter.doFilter(Unknown Source)
at com.netinnet.qdk.filter.NFilterChain.doFilter(Unknown Source)
at cn.netinnet.qdk.action.RequestFilter.doFilter(Unknown Source)
at com.netinnet.qdk.filter.NFilterChain.doFilter(Unknown Source)
at cn.nin._99cj_org.filter.SecondLevelDomainFilter.doFilter(SecondLevelDomainFilter.java:37)
at com.netinnet.qdk.filter.NFilterChain.doFilter(Unknown Source)
at com.netinnet.qdk.QDKFilter.doFilter(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2440)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2429)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:619)

用的poi3.13

   请问该如何解决的,log4j也有,可是一直报错

展开
收起
爱吃鱼的程序员 2020-06-10 10:16:15 746 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    一看就是包冲突了,poi.jar<spanstyle="font-family:'MicrosoftYaHei',Verdana,sans-serif,宋体;font-size:14px;line-height:22px;background-color:#FFFFFF;">atcn.nin._99cj.util.BatchAddUserAction.putIntoExcel(BatchAddUserAction.java:79)看这里调用的方法是不是都有看看你是不是少jar包了,你把所有的jar引用一下试试

    怎么解决的

    一样问题??

    包冲突了,公司原来的lib里面有这个包,我没注意

    找到原因了

    poi旧包与新包冲突

    官方解释:

    YoualmostcertainlyhaveanolderversionofApachePOIonyourclasspath.QuiteafewruntimesandotherpackageswillshipolderversionofApachePOI,sothisisaneasyproblemtohitwithoutyourrealising.Somewillshipjustoneoldjar,somemayshipafullsetofoldPOIjars.

    Thebestwaytoidentifytheoffendingearlierjarfilesiswithafewlinesofjava.ThesewillloadaCorePOIclass,anOOXMLclassandaScratchpadclass,andreportwheretheyallcamefrom.

    2020-06-10 10:16:30
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
《Apache Flink-重新定义计算》PDF下载 立即下载
大批量处理excel文件到ODPS中方案 立即下载
低代码开发师(初级)实战教程 立即下载