问题描述
我正在调查以下 java.lang.VerifyError
java.lang.VerifyError: (class: be/post/ehr/wfm/application/serviceorganization/report/DisplayReportServlet, method: getMonthData signature: (IILjava/util/Collection;Ljava/util/Collection;Ljava/util/HashMap;Ljava/util/Collection;Ljava/util/Locale;Lorg/apache/struts/util/MessageRe˜̴MtÌ´MÚw€mçw€mp:Â"MŒŒ
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
at java.lang.Class.getConstructor0(Class.java:2671)
在部署servlet的jboss服务器启动时,会发生
它是使用jdk-1.5.0_11和I编译的尝试用jdk-1.5.0_15重新编译没有成功,这是编译运行正常,但部署后,将发生java.lang.VerifyError。
It occurs when the jboss server in which the servlet is deployed is started.It is compiled with jdk-1.5.0_11 and I tried to recompile it with jdk-1.5.0_15 without succes. That is the compilation runs fine but when deployed, the java.lang.VerifyError occurs.
当我chan ged方法名称并得到以下错误:
When I changed the method name and got the following error:
java.lang.VerifyError: (class: be/post/ehr/wfm/application/serviceorganization/report/DisplayReportServlet, method: getMD signature: (IILjava/util/Collection;Lj ava/util/Collection;Ljava/util/HashMap;Ljava/util/Collection;Ljava/util/Locale;Lorg/apache/struts/util/MessageResources ØÅN|ØÅNÚw€mçw€mX#ÖM|XÔM
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357
at java.lang.Class.getConstructor0(Class.java:2671)
at java.lang.Class.newInstance0(Class.java:321)
at java.lang.Class.newInstance(Class.java:303)
您可以看到更多的方法签名被显示。
You can see that more of the method signature is shown.
实际的方法签名是
private PgasePdfTable getMonthData(int month, int year, Collection dayTypes,
Collection calendarDays,
HashMap bcSpecialDays,
Collection activityPeriods,
Locale locale, MessageResources resources) throws Exception {
我已经尝试用 javap
查看它,并给出方法签名,因为它应该
I already tried looking at it with javap
and that gives the method signature as it should be.
当我的其他同事查看代码,编译并部署代码时,他们有同样的问题。当构建服务器拾取代码并将其部署在开发或测试环境(HPUX)上时,会发生相同的错误。另外运行Ubuntu的自动化测试机器在服务器启动期间显示相同的错误。
When my other colleagues check out the code, compile it and deploy it, they have the same problem. When the build server picks up the code and deploys it on development or testing environments (HPUX), the same error occurs. Also an automated testing machine running Ubuntu shows the same error during server startup.
其余的应用程序运行正常,只有一个servlet出现故障。
任何想法都可以帮助您。
The rest of the application runs okay, only that one servlet is out of order.Any ideas where to look would be helpful.
推荐答案
java.lang.VerifyError
可以是您在运行时使用的不同库编译的结果。
java.lang.VerifyError
can be the result when you have compiled against a different library than you are using at runtime.
例如,当我尝试运行针对Xerces 1编译的程序,但在类路径中找到Xerces 2。在运行时找到所需的类(在$ code> org.apache。* 命名空间),所以 ClassNotFoundException
是 em> not 结果。对类和方法进行了更改,因此在运行时发现的方法签名与编译时没有匹配。
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.
通常,编译器将标记方法签名不匹配的问题。当加载类时,JVM将再次验证字节码,并且当字节码尝试执行不应允许的操作时,会引发 VerifyError
。调用返回 String
的方法,然后将该返回值存储在一个包含 List
的字段中。
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
.
这篇关于造成java.lang.VerifyError的原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!