【问题标题】:Incompatible argument to function函数参数不兼容
【发布时间】:2013-11-12 10:34:52
【问题描述】:

我的ear应用程序在本地window PC上的Tomcat 6上运行良好,但不能在同一台PC上的Weblogic server 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>

【问题讨论】:

    标签: java spring jakarta-ee servlets weblogic


    【解决方案1】:

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

    更多信息清晰的解释见这里

    可能原因一:

    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.

    【讨论】:

    • 太好了,请彻底浏览给定的链接:)。
    • 我真正想说的是请从 pom.xml 中删除所有特定于容器的 jar。根本不是好主意:(。
    • 请检查您编译的 jar 版本和运行时 jar 库。它们可能不匹配。在这里查看答案stackoverflow.com/questions/100107/…
    • 当然我会尽力帮助你:)
    • servlet-api 编译版本:Manifest-Version:1.0 Ant-Version:Apache Ant 1.6.5 Created-By:Apache Maven Built-By:edburns Package:Build-Jdk:1.5.0_06 Extension-名称:servlet-api 规范-标题:Glassfish 应用服务器规范的一个组件-供应商:Sun Microsystems Inc 实施-标题:实施-供应商:Sun Microsystems Inc 实施-版本:2.5
    猜你喜欢
    • 2013-08-09
    • 2011-06-19
    • 1970-01-01
    • 1970-01-01
    • 2021-12-09
    • 1970-01-01
    • 2016-10-15
    • 1970-01-01
    • 2022-01-26
    相关资源
    最近更新 更多