Description
duplicated from: eclipse-openj9/openj9#11957
Summary of problem
Exception raised java.lang.AssertionError: java.lang.NoSuchFieldException: target
while running java -jar corda.jar
A quick scan of the internet shows this has been seen before puniverse/quasar#321 and been added to #5139.
Switching to Hotspot (as per one suggestion) yields a deeper issue see #11956 & adoptium/adoptium-support#257
/ ____/ _________/ /___ _
/ / __ / ___/ __ / __ `/ If at first you don't succeed,
/ /___ /_/ / / / /_/ / /_/ / then we have something in common!
\____/ /_/ \__,_/\__,_/
--- Corda Open Source 4.6 (85e387e) -------------------------------------------------------------
Steps to reproduce
running java -jar corda.jar
in docker image adoptopenjdk/openjdk8:jdk8u275-b01
on s390x/LinuxOne
note: Official Corda docker images have not been compiled for s390x architecture
Symptoms
Analysis
Thanks to @joransiu for this.
From the app.log:
Caused by: java.lang.NoSuchFieldException: target
at java.lang.Class.getDeclaredFieldImpl(Native Method) ~[?:1.8.0_275]
at java.lang.Class.getDeclaredField(Class.java:825) ~[?:1.8.0_275]
at co.paralleluniverse.common.reflection.GetDeclaredField.run(GetDeclaredField.java:17) ~[quasar-core-0.7.13_r3.jar:0.7.13_r3]
at co.paralleluniverse.common.reflection.GetDeclaredField.run(GetDeclaredField.java:6) ~[quasar-core-0.7.13_r3.jar:0.7.13_r3]
at java.security.AccessController.doPrivileged(AccessController.java:734) ~[?:1.8.0_275]
at co.paralleluniverse.concurrent.util.ThreadAccess.<clinit>(ThreadAccess.java:53) ~[quasar-core-0.7.13_r3.jar:0.7.13_r3]
Given the getter/setters for this target field are Runnable type, the corresponding private field within OpenJ9 Thread implementation would be runnable (https://github.com/eclipse/openj9/blob/master/jcl/src/java.base/share/classes/java/lang/Thread.java#L96).
As private fields are usually not externalized, arguably, the issue lies in quasar code making an implementation-dependent assumption. FWIW, the other three fields that are queried do exist in our Thread implementation.
Solution
update the field name from target to runnable (alternatively, add another query for runnable if target is not found).
@pron already made the change to the R3 fork of the quasar code in Nov 2018 which made it into release-0.8.2_r3
but not v0.7.13_r3
(release 30 Jul 2020):
corda/quasar@25031be#diff-e236b21e9830dc9153172ac25b37aa2df6cc81e9ec201105a26c95bc50fbe7f7
Could we have this change made for JDK8 version of Corda and included in next Corda release.