Wednesday 26 November 2014

java.lang.VerifyError: Bad method call from inside of a branch

Ever encountered this kind of an error with no pages opening up in your cq instance?
Exception in thread "main" java.lang.VerifyError: Bad <init> method call from in
side of a branch
Exception Details:
  Location:
    com/myproject/server/MockWriter.<init>(Ljava/lang/S
tring;)V @71: invokespecial
  Reason:
    Error exists in the bytecode
  Bytecode:
    0000000: b800 164d 04bd 0018 5903 2b53 5910 ff12
    0000010: 04b8 001e 2a5f ab00 0000 0055 0000 0003
    0000020: aad3 b1ff 0000 0022 0000 9b75 0000 0037
    0000030: 60fa 8f17 0000 0040 5f5a 5903 3212 20b8
    0000040: 0024 c000 205f 57b7 0026 a700 2b5f 5a57
    0000050: b700 29a7 0022 5f5a 5903 3212 2bb8 0024
    0000060: c000 2b5f 57b7 002e a700 0dbb 0030 5912
    0000070: 32b7 0033 bf57 2ab6 0037 4e2d 2a5f b500
    0000080: 392d 57b1
  Stackmap Table:
    full_frame(@56,{UninitializedThis,Object[#32],Object[#63]},{Object[#65],Unin
itializedThis})
    full_frame(@77,{UninitializedThis,Object[#32],Object[#63]},{Object[#65],Unin
itializedThis})
    full_frame(@86,{UninitializedThis,Object[#32],Object[#63]},{Object[#65],Unin
itializedThis})
    full_frame(@107,{UninitializedThis,Object[#32],Object[#63]},{Object[#65],Uni
nitializedThis})
    full_frame(@117,{Object[#2],Object[#32],Object[#63]},{Object[#65]})

        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
        at java.lang.Class.getDeclaredConstructors(Unknown Source)
        at org.codehaus.groovy.reflection.CachedClass$2$1.run(CachedClass.java:6
9)
Well, this happens to be a problem with the JVM version.
Known versions with this problem:

1.7.0 update 55
1.7.0 update 65
1.7.0 update 67
1.8.0 update 11

Solution:
Edit the start.bat and add JVM argument "-noverify" to have the code working.

The default JVM options look like this:
::* default JVM options
if not defined CQ_JVM_OPTS set CQ_JVM_OPTS=-Xmx2048m -XX:MaxPermSize=512M -noverify -Djava.awt.headless=true

Hope this helped!

2 comments: