gpt4 book ai didi

jsp - java.lang.LinkageError : javax. servlet.jsp.JspApplicationContext.getExpressionFactory 错误

转载 作者:行者123 更新时间:2023-11-28 21:43:57 25 4
gpt4 key购买 nike

当我尝试在 Tomcat 7 上运行我的 webapp 时,出现以下异常:

exception

javax.servlet.ServletException: java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;
" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/index_jsp, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext,
have different Class objects for the type javax/el/ExpressionFactory used in the signature
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:343)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

root cause

java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/index_jsp, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ExpressionFactory used in the signature
org.apache.jsp.index_jsp._jspInit(index_jsp.java:31)
org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:49)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:180)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

似乎两个.jar 库之间存在冲突,但我不知道它们是哪个。我怎样才能找出并解决它们?

最佳答案

当您在 Web 应用程序的 /WEB-INF/lib 中包含不同服务器品牌/版本的特定于服务器的库时,就会发生这种情况,例如 jsp-api.jar el-api.jarservlet-api.jar 等。您需要将它们全部删除/WEB-INF/lib 不应包含任何特定于服务器的库。它们属于特定服务器本身(Tomcat 已经在其 /lib 文件夹中拥有它们)。

顺便说一下,这是初学者在他们的 IDE 项目中遇到 JSP/Servlet API 编译错误时常犯的错误。这应该以不同的方式解决,即通过将服务器集成到 IDE 中并将服务器作为“目标运行时”添加到项目中。

另见:

关于jsp - java.lang.LinkageError : javax. servlet.jsp.JspApplicationContext.getExpressionFactory 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8487048/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com