Using JOL with JDK 9+181

Dmitry Vyazelenko vyazelenko at yahoo.com
Fri Sep 22 17:02:33 UTC 2017


Works as described when -Djdk.attach.allowAttachSelf property is set. Why can't it be set by JOL automatically in the same way as --add-modules/--add-exports is done?

Best regards, Dmitry Vyazelenko 

    On Friday, September 22, 2017, 11:27:14 AM GMT+2, Aleksey Shipilev <shade at redhat.com> wrote:  
 
 On 09/04/2017 10:33 PM, Dmitry Vyazelenko wrote:
> # WARNING: Unable to get Instrumentation. Dynamic Attach failed: null. You may add this JAR as -javaagent manually.
> WARNING: An illegal reflective access operation has occurred
> WARNING: Illegal reflective access by org.openjdk.jol.vm.sa.ServiceabilityAgentSupport (file:/home/dmitry/projects/oss/jol/jol-core/target/classes/) to field sun.management.RuntimeImpl.jvm
> WARNING: Please consider reporting this to the maintainers of org.openjdk.jol.vm.sa.ServiceabilityAgentSupport
> 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
> ...
> Any idea on how to fix those?

These are partially fixed by:
  https://bugs.openjdk.java.net/browse/CODETOOLS-7902038

See:

$ java -version
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)

$ java -Djdk.attach.allowAttachSelf -jar jol-cli/target/jol-cli.jar internals java.lang.Object
# Running 64-bit HotSpot VM.
# Using compressed oop with 3-bit shift.
# Using compressed klass with 0x0000000800000000 base address and 0-bit shift.
# Objects are 8 bytes aligned.
# Field sizes by type: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes]
# Array element sizes: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes]

Instantiated the sample instance via default constructor.
....

Thanks,
-Aleksey
  


More information about the jol-dev mailing list