与函数不相容的参数

时间:2013-11-12 10:34:52

标签: java spring java-ee servlets weblogic

我的耳朵应用程序在本地窗口PC上的Tomcat 6上运行良好,但它无法在同一台PC上的Weblogic服务器10.3.6上运行。

Caused By: java.lang.VerifyError: (class: org/springframework/web/servlet/FrameworkServlet, method: processRequest signature: (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V) Incompatible argument to function

        at java.lang.Class.getDeclaredFields0(Native Method)
        at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
        at java.lang.Class.getDeclaredFields(Class.java:1743)
        at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.getFields.....

以下是我可能与问题相关的pom.xml的一部分。

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>compile</scope>
</dependency>

1 个答案:

答案 0 :(得分:1)

从您的webapp的/WEB-INF/lib文件夹中删除所有特定于Tomcat的库,例如el-ri.jar, el-api.jar。它会使您的webapp与不同品牌/版本的容器不兼容,从而导致此类错误。

有关详细信息,请参阅此处

可能的原因1:

当您针对不同的库编译时,

java.lang.VerifyError可能是您在运行时使用的结果。

请参阅此处Causes of getting a java.lang.VerifyError

可能的原因2:

How do I import the javax.servlet API in my Eclipse project?

特别阅读本段

You should above all never manually copy/download/move/include the individual servletcontainer-specific libraries like servlet-api.jar, jsp-api.jar, el-api.jar, j2ee.jar, javaee.jar, etc. It would only lead to future portability, compatibility, classpath and maintainability troubles, because your webapp would not work when it's deployed to a servletcontainer of a different make/version than where those libraries are originally obtained from.