IBM Support

IBM Java for Linux HowTo: Resolving "java.lang.VerifyError: JVMVRFY012 stack shape inconsistent"

Question & Answer


Question

IBM Java for Linux HowTo: Resolving "java.lang.VerifyError: JVMVRFY012 stack shape inconsistent"

Answer

This article discusses the Java error message "java.lang.VerifyError: JVMVRFY012 stack shape inconsistent" and how to resolve it.
Overview
Details

What is a Verify Error?

The JVM contains a verifier which is responsible for verifying all bytecode before being executed. Often, bytecode with internal inconsistencies or security problems will trigger a verify error.

For example,

java.lang.VerifyError: JVMVRFY012 stack shape inconsistent;
class=com/sun/xml/messaging/saaj/soap/SOAPDocumentImpl,
method=createDocumentFragment()Lorg/w3c/dom/DocumentFragment;, pc=5

What causes a Verify Error?

As a security feature, the JVM verifies all bytecodes in order to avoid injection of malicious code via bytecode modification. The error can also occur when:

-code is compiled against a different library than the one being used at runtime
-a class tries to extend a class declared as final
-a method tries to override a super method that is declared as final
-a wrong argument is passed to a method

Disabling the verification engine

The bytecode verifiier is on by default. To enable maximum verification, add the following Java command line option:

-Xverify:all

To disable the verifier, add the following Java command line option:

-Xverify:none

To enable remote strict class-loading checks on remotely loaded class use, add the following Java command line option:

-Xverify:remote

Note: For security reasons, never disable bytecode verification on a production system

Resolving a Verify Error in your code


It most cases, verify errors are the result incompatible 3rd party libraries. The diagnostic message will identify any inconsistent class and method. For example:

java.lang.VerifyError: JVMVRFY012 stack shape inconsistent;
class=com/sun/xml/messaging/saaj/soap/SOAPDocumentImpl,
method=createDocumentFragment()Lorg/w3c/dom/DocumentFragment;, pc=5


To locate the jar file a class is being loaded from, add -verbose:dynload and -verbose:class to your Java command line

Make sure you compile all classes with the same Java version. Please reference only the public class of the Java API. Your code should not depend on internal classes which are subject to change.

Section 5

Section 6

Section 7

Section 8

Section 9

Section 10

Section 11

Section 12

Section 13

Section 14

Section 15

Section 16

Section 17

Section 18

Section 19

Section 20


Contact IBM Support


If, after reading and following the above instructions, further assistance is required, please complete the following steps:

1. Confirm that you have review and completed all of the above steps.

2. Contact IBM and open a new IBM service request (i.e., a new IBM PMR).

3. Collect and upload data as per the data collection procedures noted in the above sections or package and upload the current data and details by following the instructions on this web page:


IBM Java for AIX MustGather: How to upload diagnostic data and testcases to IBM


Document Type:

Technical Document
Content Type: General
Hardware: all Power
Operating System: all Linux Versions
IBM Java: all Java Versions
Author(s): John Carver
Reviewer(s): Vidya Makineedi

[{"Product":{"code":"SG9NGS","label":"IBM Java"},"Business Unit":{"code":null,"label":null},"Component":"Not Applicable","Platform":[{"code":"PF016","label":"Linux"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
17 June 2018

UID

isg3T1025881