VisualVM redefinition failed


Error:

Redefinition failed with error 62
Check JVMTI documentation for this error code.

This occurs when you try to profile a Java application through JVisualVM. This is a bug. A workaround can be found here.

The application you want to profile must be launched with the flag:

-Xverify:none

Example for regular jar:

java -Xverify:none -jar your_app.jar

An example for Spring Boot Yarn is below. The application.yml file for AppMaster:

spring:
  ...
  yarn:
    ...
    appmaster:
      ...
      launchcontext:
        ...
        options:
          ...
          - -Xverify:none

After that, profiling the application through VisualVM will work properly.