java.lang.LinkageError:违反加载程序约束:解析接口方法javax.servlet.jsp.JspApplicationContext.getExpressionFactory()时 [英] java.lang.LinkageError: loader constraint violation: when resolving interface method javax.servlet.jsp.JspApplicationContext.getExpressionFactory()

查看:698
本文介绍了java.lang.LinkageError:违反加载程序约束:解析接口方法javax.servlet.jsp.JspApplicationContext.getExpressionFactory()时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Eclipse IDE中使用JSF 2.0.当我尝试实现JSP和Servlet时,出现以下错误:

I am using JSF 2.0 in Eclipse IDE. When I tried to implement JSP and Servlet, I get the following error:

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/exCrop_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
at org.apache.jsp.exCrop_jsp._jspInit(exCrop_jsp.java:31)
at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:49)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:181)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

这是怎么引起的,我该如何解决?

How is this caused and how can I solve it?

推荐答案

您的类路径是一团糟.

这个特殊的例外情况表明,您在Webapp的/WEB-INF/lib文件夹中乱扔了任意下载的servlet容器制造/版本的特定于servlet容器的库,该库与您实际将Web应用程序部署到的servlet容器不兼容.特定的异常消息表明您的/WEB-INF/lib包含jsp-api.jarj2ee.jar和/或javaee.jar文件.

This particular exception suggests that you've littered the webapp's /WEB-INF/lib folder with arbitrarily downloaded servletcontainer-specific libraries of a servletcontainer make/version which is incompatible with the servletcontainer where you're actually deploying the webapp to. The particular exception message suggests that your /WEB-INF/lib contains jsp-api.jar, j2ee.jar and/or javaee.jar files.

您应该删除. servlet容器已经随JSP一起提供.永远不要复制/移动特定于servletcontainer的库.它只会与目标运行时发生冲突.如果您这样做是为了解决IDE中的编译错误,那么您应该以不同的方式解决它.即,您应该在IDE中集成目标servlet容器,然后将其与项目关联为 Targeted Runtime .这样,IDE将在编译时类路径中自动使用servlet容器的库.

You should remove them. The servletcontainer already ships with JSP. You should never copy/move servletcontainer-specific libraries around. It would only clash with the target runtime. If you did this to workaround compilation errors in your IDE, then you should have solved it differently. Namely, you should integrate the target servletcontainer in your IDE and then associate it with the project as Targeted Runtime. This way the IDE will automatically use the servletcontainer's libraries in the compile time classpath.

这篇关于java.lang.LinkageError:违反加载程序约束:解析接口方法javax.servlet.jsp.JspApplicationContext.getExpressionFactory()时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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