java.lang.LinkageError:加载器约束冲突:解析接口方法 javax.servlet.jsp.JspApplicationContext.getExpressionFactory() 时
我在 Eclipse IDE 中使用 JSF 2.0。当我尝试实现 JSP 和 Servlet 时,出现以下错误:
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)
这是如何引起的以及如何解决它?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的类路径一团糟。
这个特殊的异常表明您在 web 应用程序的
/WEB-INF/lib
文件夹中随意下载了 servletcontainer make/version 的 servletcontainer 特定库,该库与您实际部署的 servletcontainer 不兼容网络应用程序到.特定的异常消息表明您的/WEB-INF/lib
包含jsp-api.jar
、j2ee.jar
和/或javaee.jar
文件。您应该删除它们。 servletcontainer已经随 JSP 一起提供。您永远不应该复制/移动特定于 servletcontainer 的库。它只会与目标运行时发生冲突。如果您这样做是为了解决 IDE 中的编译错误,那么您应该以不同的方式解决它。也就是说,您应该将目标 servlet 容器集成到 IDE 中,然后将其作为目标运行时与项目关联。这样,IDE 将在编译时类路径中自动使用 servletcontainer 的库。
另请参阅:
Your classpath is a mess.
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
containsjsp-api.jar
,j2ee.jar
and/orjavaee.jar
files.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.
See also:
将项目从 WAS6 迁移到 WAS 7 时,我遇到了同样的错误。修复方法如下:
Com.sun.faces.config.ConfigureListener
选项
应用
I had the same error when migrating a project from WAS6 to WAS 7. Here is the fix:
Com.sun.faces.config.ConfigureListener
options
applications