代码说简单也简单,说复杂那还真是寸步难行。

之前好好的excel导出功能,本地启动调试的时候突然就不行了,一直报上面的错。

一直在本地折腾了半天,去测试环境上看,又是好的,可以正常导出excel。

搜索引擎查了下才发现问题所在:

下面是项目结构:

client<--service<---dao<--common-utils

在service层中,pom文件如下:

 <dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.13</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.13</version>
</dependency>

在common-utils中,本地最近为了测试一个功能,(poi读写word),懒得新建工程,就直接加在了common-utils的pom中:

        <dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-scratchpad -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>3.9</version>
</dependency>

可以看到,两处的jar包版本不同,在idea的maven projects的窗口中可以看到:

最终打包出来的war包中,lib目录下:

版本是不匹配的,所以出现了标题中的错误。

参考:

http://stackoverflow.com/questions/33415904/apache-poi-parsing-error

http://stackoverflow.com/questions/34630209/java-lang-illegalaccesserror-tried-to-access-method-org-apache-poi-util-poilogg

maven依赖规则:

http://hae.iteye.com/blog/2097302

java.lang.IllegalAccessError: tried to access method org.apache.poi.util.POILogger.log from class org.apache.poi.openxml4j.opc.ZipPackage的更多相关文章

  1. java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.<init>()V from 解决

    在用spark的yarn-cluster模式跑fpgrowth进行频繁项集挖掘的时候,报如下错误: ERROR yarn.ApplicationMaster: User class threw exc ...

  2. java.lang.IllegalAccessError: tried to access method

    java.lang.IllegalAccessException: access to method denied 06-23 16:12:39.128 1253-1253/com.hbjyjt.oa ...

  3. java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory

    java.lang.IllegalAccessError: tried to access field org.slf4j.impl.Static.. java.lang.IllegalAccessE ...

  4. Error during generated code invocation: com.intellij.debugger.engine.evaluation.EvaluateException: Method threw 'java.lang.IllegalAccessError' exception.

    场景描述: 再从该数据库中读取数据进行处理的时候,需要将某个字段加入到一个动态的map中,然后需要对该map进行filter过滤,在执行过滤方法的时候报错 Error during generated ...

  5. java.lang.IllegalAccessError: org.apache.commons.dbcp.DelegatingPreparedStatement.isClosed()Z

    做spring和mybaits整合时出现的错误,让这个问题困扰了一早上,通过查资料终于把这个问题解决了 具体问题描述: java.lang.IllegalAccessError: org.apache ...

  6. Android Xposed框架出现java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation问题

    第一次玩Xposed框架,按照多个demo的格式写了一个demo发现死活不进入 public abstract void handleLoadPackage(LoadPackageParam lppa ...

  7. Android 学习之异常总结--java.lang.IllegalStateException:Could not execute method of the activity

    在android学习过程中通常会遇到java.lang.IllegalStateException:Could not execute method of the activity这个错误:非法状态的 ...

  8. Xposed出现 java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation

    Xposed出现 java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implem ...

  9. Spring Scheduled定时任务报错 java.lang.IllegalStateException: Encountered invalid @Scheduled method 'xxx': For input string: "2S"

    报错信息如下: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ding ...

随机推荐

  1. IP地址与域名的关系

    1.IP地址:IP地址是用来唯一标识互联网上计算机的逻辑地址,让电脑之间可以相互通信. 每台连网计算机都依靠IP地址来互相区分.相互联系 2.域名:由于IP地址是数字标识,使用时难以记忆和书写,因此在 ...

  2. python中的lambda函数用法

    例1:传入多个参数的lambda函数def sum(x,y): return x+y用lambda来实现:p = lambda x,y:x+yprint(4,6) 例2:传入一个参数的lambda函数 ...

  3. 记kkpager分页控件的使用

    kkpager支持异步加载分页: 1.页面添加div标签和引用JS,默认标签为<div id="kkpager"></div> 引用JS和样式 <sc ...

  4. 什么是IPFS?(二)

    IPFS的的"宏伟"目标是取代HTTP, 那么先来看看IPFS是如何工作的? IPFS为每一个文件分配一个独一无二的哈希值(文件指纹: 根据文件的内容进行创建), 即使是两个文件内 ...

  5. 使用Bootatrap的心得

    使用Bootatrap的心得: 更新中... 在使用过一端时间的Bootstrap之后, 发现自己进入了使用误区,本来人家就为你提供好了样式丰富的各种样式,容器.但是我却在一边使用人家的样式,一边自己 ...

  6. cloneNode和replaceChild

    node.cloneNode(deep) var node=document.getElementById("myList2").lastChild.cloneNode(true) ...

  7. POJ1331 Multiply(strtol函数练习)

    题目链接:http://poj.org/problem?id=1331 主要介绍strtol函数: long int strtol(const char *nptr,char **endptr,int ...

  8. 【Python】随机模块random & 日期时间のtime&&datetime

    ■ random 顾名思义,random提供了python中关于模拟随机的一些方法.这些方法都一看就懂的,不多说了: random.random() 返回0<n<=1的随机实数 rando ...

  9. 将 Shiro 作为应用的权限基础 一:shiro的整体架构

    将 Shiro 作为应用的权限基础 一:shiro的整体架构 近来在做一个重量级的项目,其中权限.日志.报表.工作量由我负责,工作量还是蛮大的,不过想那么多干嘛,做就是了. 这段时间,接触的东西挺多, ...

  10. Find The Multiply

    Find The Multiply poj-1426 题目大意:给你一个正整数n,求任意一个正整数m,使得n|m且m在十进制下的每一位都是0或1. 注释:n<=200. 想法:看网上的题解全是b ...