티스토리 뷰

이전에 이와 거의 유사한 오류를 조치한 적이 있었다.

An illegal reflective access operation has occurred 오류 조치

application의 OSS version을 올리는데 특정 기능을 수행중에 위와 같은 Warning이 발생하였다. WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.apach..

oingdaddy.tistory.com

놀라운건 두달이 지난건데 기억이 전혀 나지 않는다..
이때는 결국 poi 의 version 문제로 밝혀졌는데 이번에는 또 조금 다르다.

WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (file:/C:/Users/oing/.m2/repository/org/springframework/spring-core/4.3.22.RELEASE/spring-core-4.3.12.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1 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


전에도 언급했지만 원인은 쉽게 설명하자면 뭔가 솔루션들간의 버전이 잘 맞지 않아서 발생하는것이다. 이번에는 jdk와 spring version간의 문제로 발생하는 것으로 보인다.

세가지 방법으로 조치를 할 수 있다.

1. spring (or springboot) 의 version 을 올린다.

위의 WARNING 로그 두번째줄을 보면 spring의 version을 4.3.22.RELEASE 를 사용하는 것을 확인할 수 있다.
spring만 사용한다면 version을 최소 5.1 이상으로 올려주고 springboot를 사용한다면 2.1 이상으로 올려준다.

2. jvm 옵션을 추가해서 해결한다.

java --add-opens java.basejava.lang=ALL-UNNAMED -jar [jarPath]

위와 같이 jvm 옵션으로 --add-opens java.basejava.lang=ALL-UNNAMED 를 추가해준다.

3. jaxb-api dependency를 추가한다.

이전에 jdk8에서 jdk11로 mig하는 방법에 대해 기술을 한 적이 있는데 이 문제가 발생하는 상황도 이와 유사하다. 따라서 해결하는 방법도 동일하다고 보면 된다.

<dependency> <groupId>javax.xml</groupId> <artifactId>jaxb-api</artifactId> <version>2.1</version> </dependency>

위와 같은 dependency를 pom.xml에 추가를 해준다.

끝!

댓글
최근에 올라온 글
최근에 달린 댓글
«   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