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

查看:147
本文介绍了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应用程序的/WEB-INF/lib中包含不同服务器品牌/版本的特定于服务器的库时,就会发生这种情况,例如, el-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天全站免登陆