Akka快速入门:发生了非法反射访问操作

3
在我的 Mac 终端上运行官方的 Akka Quickstart(点击跳转)时,出现以下错误:
Getting org.scala-sbt sbt 1.2.8 ...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.ivy.util.url.IvyAuthenticator (file:/Users/helios/eclipse-workspace/akka-quickstart-java/sbt-dist/bin/sbt-launch.jar) to field java.net.Authenticator.theAuthenticator
WARNING: Please consider reporting this to the maintainers of org.apache.ivy.util.url.IvyAuthenticator
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
reStart

这是预期的结果吗?我该如何修复它?

2个回答

4

这是一条警告信息,而不是错误信息。

以下是来自Oracle JDK 9迁移指南的引用:

https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-7BB28E4D-99B3-4078-BDC4-FC24180CE82B

Understanding Runtime Access Warnings

Some tools and libraries use reflection to access parts of the JDK that are meant for internal use only. This illegal reflective access will be disabled in a future release of the JDK. In JDK 9, it is permitted by default and a warning is issued.

For example, here is the warning issued when starting Jython:

java -jar jython-standalone-2.7.0.jar
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by jnr.posix.JavaLibCHelper (file:/C:/Jython/jython2.7.0/jython-standalone-2.7.0.jar) to method sun.nio.ch.SelChImpl.getFD()
WARNING: Please consider reporting this to the maintainers of jnr.posix.JavaLibCHelper
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
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)

If you see a warning like this, contact the maintainers of the tool or library. The second line of the warning names the exact JAR file whose code used reflection to access an internal part of the JDK.

By default, a maximum of one warning about reflective access is issued in the lifetime of the process started by the java launcher. The exact timing of the warning depends on the behavior of tools and libraries performing reflective–access operations. The warning may appear early in the lifetime of the process, or a long time after startup.

You can disable the warning message on a library-by-library basis by using the --add-opens command line flag.


0

我遇到了相同的警告,但跟着一个空指针异常,即“this.text”为空...很抱歉我现在没有错误信息。

我当时用的是Java 11,但当我切换到Java 8时一切正常!


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接