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?
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
contains jsp-api.jar
, j2ee.jar
and/or javaee.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.
I had the same error when migrating a project from WAS6 to WAS 7. Here is the fix:
Com.sun.faces.config.ConfigureListener
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With