티스토리 뷰

application의 OSS version을 올리는데 특정 기능을 수행중에 위와 같은 Warning이 발생하였다. 

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.poi.util.DocumentHelper (file:/C:/Users/User/.m2/repository/org/apache/poi/poi-ooxml/3.17/poi-ooxml-3.17.jar) to method com.sun.org.apache.xerces.internal.util.SecurityManager.setEntityExpansionLimit(int)
WARNING: Please consider reporting this to the maintainers of org.apache.poi.util.DocumentHelper
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

말 그대로 Warning이라 application이 동작하는데 지장은 없지만 영 찜찜하다. 그래서 맨 첫줄에 나온대로 An illegal reflective access operation has occurred 로 검색을 해보니 여러가지 해결책이 나왔다. 

(필자의 환경은 JDK11, springboot 2.5.4 (spring 5.3.9) poi 3.17 이었다.)

 

첫번째는 JDK11을 JDK8로 고쳐라 였다. 하지만 내 상황에서는 적용 불가능한 해결책이라 이건 그냥 패스

두번째는 실행시에 --illegal-access=permit 옵션을 줘서 Warning이 안뜨게 해라 라는데 찜찜함이 해소되지 않아서 패스

세번째는 springboot는 2.1, spring을 사용하면 5.1.5 이상의 version으로 올리면 된다는데 필자는 이미 springboot 2.5대를 사용하고 있어서 자동 패스다. 

 

대략적으로 이런 솔루션들이 나와 있는데 나의 문제는 해결되지 않아서 이제 로그에 있는대로 poi 관련 문제로 인식을 하고 찾아 보았다. 필자는 poi 3.11 버전을 사용하다가 3.17로 올리고 이런 문제가 발생했는데 솔루션으로 찾은건 poi 버전을 4.1.2로 올리면 이런 문제가 발생하지 않는다고 해서 버전을 올렸다. 

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

이렇게 변경을 하니 그 이후로는 문제가 발생하지 않는다. 단 버전 변경에 따른 migration은 해야 한다. (적어도 필자 소스에서는 3.17과 4.1.2는 고칠게 없었다.)

 

끝!

댓글
최근에 올라온 글
최근에 달린 댓글
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31