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

发布于 2021-11-28 15:54:22 字数 3551 浏览 412 评论 4

自己写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也有,可是一直报错

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

凌乱心跳 2021-12-02 00:19:16

找到原因了

poi旧包与新包冲突

官方解释:

You almost certainly have an older version of Apache POI on your classpath. Quite a few runtimes and other packages will ship older version of Apache POI, so this is an easy problem to hit without your realising. Some will ship just one old jar, some may ship a full set of old POI jars.

The best way to identify the offending earlier jar files is with a few lines of java. These will load a Core POI class, an OOXML class and a Scratchpad class, and report where they all came from.

醉生梦死 2021-12-02 00:14:51

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

笑红尘 2021-11-30 19:52:03

at cn.nin._99cj.util.BatchAddUserAction.putIntoExcel(BatchAddUserAction.java:79) 看这里调用的方法是不是都有

小瓶盖 2021-11-30 11:11:50

一看就是包冲突了,poi.jar

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文