运行时发生非法反射访问操作

时间:2018-06-13 13:01:54

标签: java corda

我试图运行我的corda节点,但我遇到了一个奇怪的问题,正如您在日志中看到的那样,节点正在正常启动

C:\Repositorio\cordapp-template-kotlin\build\nodes>runnodes --log-to-console --logging-level=DEBUG
Starting nodes in C:\Repositorio\cordapp-template-kotlin\build\nodes
Starting corda.jar in C:\Repositorio\cordapp-template-kotlin\build\nodes\Notary on debug port 5005
Starting corda.jar in C:\Repositorio\cordapp-template-kotlin\build\nodes\PartyA on debug port 5006
Starting corda-webserver.jar in C:\Repositorio\cordapp-template-kotlin\build\nodes\PartyA on debug port 5007
Starting corda.jar in C:\Repositorio\cordapp-template-kotlin\build\nodes\PartyB on debug port 5008
Starting corda-webserver.jar in C:\Repositorio\cordapp-template-kotlin\build\nodes\PartyB on debug port 5009
Started 5 processes
Finished starting nodes

当它打开5个控制台来实际运行Web服务和节点时,就会发生这种情况。

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by Capsule (file:/C:/Repositorio/cordapp-template-kotlin/build/nodes/PartyB/corda.jar) to field com.sun.jmx.mbeanserver.JmxMBeanServer.mbsInterceptor
WARNING: Please consider reporting this to the maintainers of Capsule
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
Listening for transport dt_socket at address: 5008
[quasar] ERROR: java/lang/Thread
java.lang.IllegalArgumentException
        at co.paralleluniverse.asm.ClassReader.<init>(Unknown Source)
        at co.paralleluniverse.asm.ClassReader.<init>(Unknown Source)
        at co.paralleluniverse.asm.ClassReader.<init>(Unknown Source)
        at co.paralleluniverse.fibers.instrument.MethodDatabase.checkFileAndClose(MethodDatabase.java:344)
        at co.paralleluniverse.fibers.instrument.MethodDatabase.checkClass(MethodDatabase.java:324)
        at co.paralleluniverse.fibers.instrument.MethodDatabase.getOrLoadClassEntry(MethodDatabase.java:183)
        at co.paralleluniverse.fibers.instrument.MethodDatabase.isMethodSuspendable0(MethodDatabase.java:194)
        at co.paralleluniverse.fibers.instrument.MethodDatabase.isMethodSuspendable(MethodDatabase.java:161)
        at co.paralleluniverse.fibers.instrument.InstrumentMethod.isSuspendableCall(InstrumentMethod.java:231)
        at co.paralleluniverse.fibers.instrument.LabelSuspendableCallSitesClassVisitor$1.visitMethodInsn(LabelSuspendableCallSitesClassVisitor.java:64)
        at co.paralleluniverse.asm.ClassReader.a(Unknown Source)
        at co.paralleluniverse.asm.ClassReader.b(Unknown Source)
        at co.paralleluniverse.asm.ClassReader.accept(Unknown Source)
        at co.paralleluniverse.asm.ClassReader.accept(Unknown Source)
        at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.instrumentClass(QuasarInstrumentor.java:123)
        at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.instrumentClass(QuasarInstrumentor.java:94)
        at co.paralleluniverse.fibers.instrument.JavaAgent$Transformer.transform(JavaAgent.java:209)
        at java.instrument/java.lang.instrument.ClassFileTransformer.transform(Unknown Source)
        at java.instrument/sun.instrument.TransformerManager.transform(Unknown Source)
        at java.instrument/sun.instrument.InstrumentationImpl.transform(Unknown Source)
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
        at java.base/java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(Unknown Source)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(Unknown Source)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(Unknown Source)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(Unknown Source)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown Source)
[quasar] ERROR: java/lang/Thread
java.lang.IllegalArgumentException
        at co.paralleluniverse.asm.ClassReader.<init>(Unknown Source)
        at co.paralleluniverse.asm.ClassReader.<init>(Unknown Source)
        at co.paralleluniverse.asm.ClassReader.<init>(Unknown Source)
        at co.paralleluniverse.fibers.instrument.MethodDatabase.checkFileAndClose(MethodDatabase.java:344)
        at co.paralleluniverse.fibers.instrument.MethodDatabase.checkClass(MethodDatabase.java:324)

控制台的打印屏幕:
printscreen of the consoles

有没有人遇到同样的问题?我不知道如何调试它。

2 个答案:

答案 0 :(得分:1)

您正在运行Java 10. Corda仅在Oracle JDK 8 JVM的版本8u131 +上受支持。

您可以在此处查看所需的Java版本:https://docs.corda.net/getting-set-up.html

答案 1 :(得分:0)

File > Project Structure... to 1.8.0_242下更改Project SDK后,您可能还需要取消链接链接,通过以下方式再次Gradle:

  1. 在Gradle窗口上右键单击您的Gradle项目,然后单击Unlink Gradle Project
  2. 转到File > Close Project
  3. 再次打开您当前的项目,您会看到一条消息IntelliJ IDEA found a Gradle build script
  4. 单击其下方的Import Gradle Project,然后等待其完成。

之所以写这个,是因为我不小心在Java 11环境中导入了Gradle。但是,更改项目SDK之后,由于java.lang.IllegalArgumentException错误,我仍然无法运行单元测试。