Causes of getting a java.lang.VerifyError
java.lang.VerifyError
can be the result when you have compiled against a different library than you are using at runtime.
For example, this happened to me when trying to run a program that was compiled against Xerces 1, but Xerces 2 was found on the classpath. The required classes (in org.apache.*
namespace) were found at runtime, so ClassNotFoundException
was not the result. There had been changes to the classes and methods, so that the method signatures found at runtime did not match what was there at compile-time.
Normally, the compiler will flag problems where method signatures do not match. The JVM will verify the bytecode again when the class is loaded, and throws VerifyError
when the bytecode is trying to do something that should not be allowed -- e.g. calling a method that returns String
and then stores that return value in a field that holds a List
.
debugging a java.lang.VerifyError
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.
java.lang.VerifyError:Illegal type in constant pool
This is now solved, it was probably caused by bytecode size of one of my methods exceeded the 64kb limit. Causes of getting a java.lang.VerifyError
Related Topics
Making a Robust, Resizable Swing Chess Gui
How to Assert That a Certain Exception Is Thrown in Junit Tests
Including Dependencies in a Jar With Maven
How to Split a String With Any Whitespace Chars as Delimiters
Standard Concise Way to Copy a File in Java
How to Convert Number to Words in Java
What Causes Java.Lang.Incompatibleclasschangeerror
Java.Net.Connectexception: Connection Refused
How to Make an Executable Jar File
Resolving Dependency Problems in Apache Spark
Type List VS Type Arraylist in Java
How to Parse Command Line Arguments in Java
Why Do This() and Super() Have to Be the First Statement in a Constructor