debugging a java.lang.VerifyError
I am getting a java.lang.VerifyError, on the page of oracle it says it's thrown be开发者_如何学运维cause of inconsistencies or security problems. But this can be an awful lot of things and I don't even know what I'm looking for or in which class I should look.
The error message doesn't clarify things either:
java.lang.VerifyError: (class: proto/lua/libraries/ProtoLib$Lib1, method: call signature: ()Lproto/lua/LuaValue;) Wrong return type in function
What inconsistencies should I be on the lookout for? And can anyone tell in what class I should look based on that error?
Any general help/info on the topic of these exceptions would be appreciated too
EDIT: I rewrote much of the Lua Library and until I got this error that worked perfectly fine in every aspect and I use Java SE 6 Update 26
EDIT: Whole error:
java.lang.VerifyError: (class: proto/lua/libraries/ProtoLib$Lib1, method: call signature: ()Lproto/lua/LuaValue;) Wrong return type in function
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at proto.lua.libraries.LibFunction.bind(LibFunction.java:169)
at proto.lua.libraries.LibFunction.bind(LibFunction.java:152)
at proto.lua.libraries.ProtoLib.call(ProtoLib.java:26)
at proto.lua.otherstuff.OneArgFunction.call(OneArgFunction.java:66)
at proto.lua.LuaValue.load(LuaValue.java:1358)
at proto.lua.RavenLua.standardGlobals(RavenLua.java:100)
at proto.ProjectPROTO.<clinit>(ProjectPROTO.java:51)
Could not find the main class: proto.ProjectPROTO. Program will exit.
Exception in thread "main" Java Result: 1
All proto.xxx.xxx.xxx classes are part of the source
EDIT: Well apparently the error was caused since I forgot some @Override annotations, don't know what made them start giving errors though.
What is the full stack trace? It should show that which class is calling that method. Probably the reason is that the code is being executed against a different version of the library that it was compiled against, and there is some incompatible change between those library versions (from the error message it appears to be a different method return type).
If that error is not about any library, but about your own code, then do a clean build. The compiler should produce a compile error about all things which may cause a verify error at runtime. Or if the source code is correct, it should rebuild all the class files correctly.
The single biggest source of java.lang.Verify errors is JVM version incompatibilities between your dependent libraries and your main application. So if you are running your application using Java 5 and the dependent library was compiled with Java 6 you could run into issues. I would start off investigating what version of Java was used to compile the version of Protolib? you are using.
As per @Perception's answer, but I would add:
The most usual reason is your runtime environment is using a different (older) JVM version to your compile environment.
精彩评论