java.lang.LinkageError: javax.servlet.jsp.JspApplicationContext.getExpressionFactory [英] java.lang.LinkageError: javax.servlet.jsp.JspApplicationContext.getExpressionFactory

查看:27
本文介绍了java.lang.LinkageError: javax.servlet.jsp.JspApplicationContext.getExpressionFactory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在 Tomcat 7 上运行我的 web 应用程序时,出现以下异常:

When I try to run my webapp on Tomcat 7, I got the following exception:

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 库之间似乎存在冲突,但我不知道它们是哪个.我怎样才能找出它们并解决它?

It seems that there's a conflict between two .jar librairies, but I don't know which they are. How can I figure them out and solve it?

推荐答案

当您在 /WEB-INF/lib您的 Web 应用程序,例如 jsp-api.jarel-api.jarservlet-api.jar 等.您需要删除所有这些./WEB-INF/lib 不应包含任何特定于服务器的库.它们属于特定的服务器本身(Tomcat 已经在其 /lib 文件夹中拥有它们).

That will happen when you include server-specific libraries of a different server make/version in the /WEB-INF/lib of your web application, such as jsp-api.jar, el-api.jar, servlet-api.jar, etc. You need to remove them all. The /WEB-INF/lib should not contain any server-specific libraries. They belongs in the specific server itself (Tomcat has them in its /lib folder already).

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

This is by the way a pretty common beginner's mistake whenever they encounter compilation errors on the JSP/Servlet API in their IDE project. This should have been solved differently, namely by integrating the server in the IDE and adding the server as "Target runtime" to the project.

这篇关于java.lang.LinkageError: javax.servlet.jsp.JspApplicationContext.getExpressionFactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆