简体   繁体   English

调试 java.lang.VerifyError

[英]debugging a java.lang.VerifyError

I am getting a java.lang.VerifyError, on the page of oracle it says it's thrown because of inconsistencies or security problems.我在 oracle 的页面上收到 java.lang.VerifyError,它说它是由于不一致或安全问题而引发的。 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.但这可能是很多事情,我什至不知道我在寻找什么,也不知道我应该看哪个 class。

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?任何人都可以根据该错误告诉我应该看什么 class 吗?

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编辑:我重写了 Lua 库的大部分内容,直到我得到这个在各个方面都运行良好的错误,我使用 Java SE 6 更新 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所有 proto.xxx.xxx.xxx 类都是源的一部分

EDIT: Well apparently the error was caused since I forgot some @Override annotations, don't know what made them start giving errors though.编辑:显然错误是因为我忘记了一些 @Override 注释而引起的,但不知道是什么让他们开始给出错误。

What is the full stack trace?什么是完整的堆栈跟踪? It should show that which class is calling that method.它应该显示哪个 class 正在调用该方法。 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.或者如果源代码正确,它应该正确重建所有 class 文件。

The single biggest source of java.lang.Verify errors is JVM version incompatibilities between your dependent libraries and your main application. java.lang.Verify 错误的最大来源是您的依赖库和主应用程序之间的 JVM 版本不兼容。 So if you are running your application using Java 5 and the dependent library was compiled with Java 6 you could run into issues.因此,如果您使用 Java 5 运行应用程序并且依赖库是使用 Java 6 编译的,您可能会遇到问题。 I would start off investigating what version of Java was used to compile the version of Protolib?我会开始调查使用什么版本的 Java 来编译 Protolib 的版本? you are using.您正在使用。

As per @Perception's answer, but I would add:根据@Perception 的回答,但我会补充:

The most usual reason is your runtime environment is using a different (older) JVM version to your compile environment.最常见的原因是您的运行时环境对您的编译环境使用了不同的(旧)JVM 版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM