MyBatis警告信息 All illegal access operations will be denied in a future release
今天测试Mybatis环境突然报了下面几行警告信息
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.ibatis.reflection.Reflector (file:/F:/Wxh_Java/Maven/Maven-Repository/org/mybatis/mybatis/3.4.5/mybatis-3.4.5.jar) to method java.lang.Class.checkPackageAccess(java.lang.SecurityManager,java.lang.ClassLoader,boolean)
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: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.ibatis.reflection.Reflector (file:/F:/Wxh_Java/Maven/Maven-Repository/org/mybatis/mybatis/3.4.5/mybatis-3.4.5.jar) to method java.lang.Class.checkPackageAccess(java.lang.SecurityManager,java.lang.ClassLoader,boolean)
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
注意到后面一句话
WARNING: All illegal access operations will be denied in a future release
翻译为中文
所有非法访问操作将被拒绝在未来的版本
看到这句话很容易联想到是版本问题,大概是mybatis版本和jdk版本不匹配,于是更换了低版本的mybatis(我用的jdk11)
于是我更换了jdk1.8就没有警告信息了,后来我改回jdk11,同时提高了mybatis包的版本也没有警告信息
这样看着舒服多了
总结
这种警告信息是jdk版本和mybatis版本不匹配造成的,虽然没有太大的影响,但是还是建议大家使用相匹配的版本,避免性能或者其他可能存在的问题,毕竟找Bug很痛苦的。
解决办法:
1.如果mybatis版本较高,降低mybatis版本或者提高JDK版本
2.如JDK版本较高(jdk1.8 yyds),降低jdk版本或者提高MyBatis版本
Bug解决之时等于饭点。
转载请注明:MyBatis警告信息 All illegal access operations will be denied in a future release | 胖虎的工具箱-编程导航