Last active
September 23, 2016 09:30
-
-
Save raphw/4044df5d106766edac8b9addd135e1fb to your computer and use it in GitHub Desktop.
Java agent problem on J9.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Foo { | |
public static void main(String[] args) throws UnmodifiableClassException, InterruptedException { | |
// jar: https://bintray.com/raphw/maven/download_file?file_path=net%2Fbytebuddy%2Fbyte-buddy-agent%2F1.4.26%2Fbyte-buddy-agent-1.4.26.jar | |
Instrumentation instrumentation = ByteBuddyAgent.install(); | |
System.out.println(instrumentation.isRedefineClassesSupported()); | |
System.out.println(instrumentation.isRetransformClassesSupported()); | |
// Successfully attaches agent to running process but also prints: | |
// *** java.lang.instrument ASSERTION FAILED ***: "jvmtierror == JVMTI_ERROR_NOT_AVAILABLE" at JPLISAgent.c line: 1009 | |
// Prints 'false, false' even though manifest headers are specified correctly | |
// However: prints 'true, true' if another transformation-capable Javaagent was attached at startup. | |
// Its the easiest to attach the debugger to the process which implies such an agent. | |
// This also avoids the assertion. | |
// java version "1.8.0" | |
// Java(TM) SE Runtime Environment (build pxa6480sr3fp11-20160817_02(SR3 FP11)) | |
// IBM J9 VM (build 2.8, JRE 1.8.0 Linux amd64-64 Compressed References 20160816_315341 (JIT enabled, AOT enabled) | |
// J9VM - R28_20160816_1459_B315341 | |
// JIT - tr.r14.java.green_20160726_121883 | |
// GC - R28_20160816_1459_B315341_CMPRSS | |
// J9CL - 20160816_315341) | |
// JCL - 20160816_01 based on Oracle jdk8u101-b13 | |
// Googling this issue shows a dozen similar issues. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
J9 doesn't support redefinition / retransformation when using late attach. Those capabilities need to be requested at startup.