Illegal reflective access by org.apache.ibatis.reflection.Reflector 문제

2020. 6. 3. 15:46IT개발/iBatis & MyBatis

반응형

문제 : 

Initialized JPA EntityManagerFactory for persistence unit 'default'

WARNING: An illegal reflective access operation has occurred

WARNING: Illegal reflective access by org.apache.ibatis.reflection.Reflector (file:/C:/dev/eclipse202003/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/xxxxxxxxx/WEB-INF/lib/mybatis-3.4.1.jar) to method java.lang.Object.finalize()

WARNING: Please consider reporting this to the maintainers of org.apache.ibatis.reflection.Reflector

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


과정 : 

위와 같이 메시지가 떴길래~ 아래처럼 

최신 mybatis로 업그레이드 하니 바로 되네;;;


<dependency>

    <groupId>org.mybatis</groupId>

    <artifactId>mybatis</artifactId>

    <version>3.5.4</version>

</dependency>


결론 : 최신 mybatis로 업그레이드 하랏!

===============================================

참고자료 : https://www.logicbig.com/tutorials/core-java-tutorial/modules/illegal-access-operations.html

Java 9 Modules - The Unnamed Module and Accessing JDK Internal Code via Reflection

[Updated: Mar 16, 2018, Created: Mar 15, 2018]

In the last example we saw that a Java 9 module cannot use reflection to access non-public field/method/constructor unless the target module 'opens' itself for reflection. In this tutorial we will learn how the code that was written in Java 8 or before can still continue to work without explicitly opening for reflection.

The old code which runs in Java 9 is automatically promoted to unnamed modules. Java 9 introduced a new JVM option --illegal-access which can be assigned one of the following values:

  • permit (default):

    This mode automatically 'opens' packages (written in Java 8 or older code) when run on the classpath. This allows code that relies on the use of setAccessible to break into JDK internals, to continue working as per previous releases.

    In this mode, the first reflective-access operation to any JDK package causes a warning to be issued. However, no warnings are issued after the first occurrence. This mode is the default for JDK 9 but will change in a future release.

  • warn:

    This mode is identical to 'permit' except that a warning message is issued for each illegal reflective-access operation.

  • debug:

    This mode is identical to 'warn' except that both a warning message and a stack trace are issued for each illegal reflective-access operation.

  • deny:

    This mode disables all illegal-access operations except for those enabled by other command-line options, such as--add-opens. This mode will become the default in a future release.

Note that this option may not be available in future JDK versions at all. From Java tool doc:

 

The default mode, --illegal-access=permit, is intended to make you aware of code on the class path that reflectively accesses any JDK-internal APIs at least once. To learn about all such accesses, you can use the warn or the debug modes. For each library or framework on the class path that requires illegal access, you have two options:

  • If the component's maintainers have already released a fixed version that no longer uses JDK-internal APIs then you can consider upgrading to that version.

  • If the component still needs to be fixed, then you can contact its maintainers and ask them to replace their use of JDK-internal APIs with the proper exported APIs.


반응형