Has anyone run into this exception when running hessian on a JRockit VM?
Caused by: java.lang.ArrayIndexOutOfBoundsException: -418
at com.caucho.hessian.util.IdentityIntMap.put(IdentityIntMap.java:141)
at com.caucho.hessian.io.Hessian2Output.addRef(Hessian2Output.java:1285)
at com.caucho.hessian.io.UnsafeSerializer.writeObject(UnsafeSerializer.java:157)
at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:421)
at com.caucho.hessian.io.CollectionSerializer.writeObject(CollectionSerializer.java:102)
at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:421)
at com.caucho.hessian.io.UnsafeSerializer$ObjectFieldSerializer.serialize(UnsafeSerializer.java:293)
... 34 more
I spent over a week troubleshooting this problem only to find out that hessian works fine with the HotSpot VM but consistently fails serializing certain objects using the JRockit VM. I actually came up with a simple fix but it required modifying the IdentityIntMap.java code and update the hessian jar file.
Here is the fix that I came up with. I couldn't figure out how to notify the maintainers of the Hessian code so I'm posting it here. Modify the file:
com.caucho.hessian.util.IdentityIntMap.java starting at line 112:
Also change the code in the next method starting at line 135: