Question & Answer
Question
IBM Java for Linux HowTo: Resolving "java.lang.VerifyError: JVMVRFY012 stack shape inconsistent"
Answer
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
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
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
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.
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 |
Was this topic helpful?
Document Information
More support for:
IBM Java
Software version:
Version Independent
Operating system(s):
Linux
Document number:
632243
Modified date:
17 June 2018
UID
isg3T1025881